git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] reset: allow "-" short hand for previous commit

From
SSSudhanshu Shekhar <sudshekhar02@gmail.com>
Date
Mar 4, 2015, 07:07 UTC
Message-ID
<CAODo60qimjiMfWY_FNuOcVaYc=JdbTv_4SJ3BROC-9Jo5qWkdA@mail.gmail.com>
In-Reply-To
<xmqq1tl5acwu.fsf@gitster.dls.corp.google.com>
Hi,
Show 12 quoted lines
> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> Sudhanshu Shekhar <sudshekhar02@gmail.com> writes:
>>
>>> From: SudShekhar <sudshekhar02@gmail.com>
>>
>> Please, set your configuration to have the same identity for commit and
>> send-email. It seems your commiter ID (user.name) does not contain your
>> last name.
>
> Actually, the token does not match either of the two names; it looks
> like two names smashed together into a single nickname token.
Sorry, I had set my irc nick as the commiter id. I have changed this to my name.
Show 8 quoted lines
>>> builtin/reset.c | 2 ++
>>
>> Doesn't this deserve a test?
>>
>> +             if(!strcmp(argv[0],"-"))
>> +                     argv[0]="@{-1}";
>>
>> Wrong spacing (around = and after ,).
Thanks for pointing this out. I have corrected it.
> What should worry us even more is what the user would get when @{-1}
> does not resolve to something the command can use.  It would be bad
> if we give an error message with @{-1} in it that the user never
> typed (and may not even understand what it means).

I apologize for having overlooked this use case. I have made some changes and I think this should work now. I will email the updated patch in the next email (I hope this is the correct procedure). Please let me know your thoughts. Also, this use case hasn't been handled in the case of git merge.

Another thing, can someone guide me regarding the right place to add a test case? Should it be t7102-reset.sh or some other file?

Previous: Junio C HamanoNext: Sudhanshu Shekhar
Message 4 of 12 in “reset: allow "-" short hand for previous commit”
  1. reset: allow "-" short hand for previous commitSudhanshu Shekhar, Mar 3, 2015
  2. Matthieu MoyMar 3, 2015
  3. Junio C HamanoMar 3, 2015
  4. Sudhanshu ShekharMar 4, 2015
  5. reset: allow "-" short hand for previous commitSudhanshu Shekhar, Mar 4, 2015
  6. Eric SunshineMar 4, 2015
  7. Junio C HamanoMar 5, 2015
  8. 1/2 reset: allow "-" short hand for previous commitSudhanshu Shekhar, Mar 7, 2015
  9. Matthieu MoyMar 8, 2015
  10. 1/2 Teach reset the same short-hand as checkoutSudhanshu Shekhar, Mar 8, 2015
  11. 2/2 Added test cases for git reset -Sudhanshu Shekhar, Mar 8, 2015
  12. David AguilarMar 8, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.