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

Re: [v2 PATCH 2/2] reset: add tests for git reset -

From
Torsten Bögershausen <tboegi@web.de>
Date
Mar 10, 2015, 17:23 UTC
Message-ID
<54FF288D.3000304@web.de>
In-Reply-To
<1426001883-6423-2-git-send-email-dyoucme@gmail.com>
On 2015-03-10 16.38, Sundararajan R wrote:
> Helped-by: Torsten Bögershausen <tboegi@web.de>

There seems to be an issue that the mail is encoded from (what ? Latin-1) into UTF-8 2 times

The easy solution is to remove the line, I'm OK with that, since a review-comment is not necessarily motivating a Helped-by, at least not for me. Mentioning it in the comments good and is enough.

But why is the mail "encoded twice" ? (this what the header says:)
  X-Mailer: git-send-email 2.1.0
  Content-Type: text/plain; charset=UTF-8
Can somebody help out with a good explanation ?

Another (minor) thing: There is nothing wrong with the test, but we can make it 3% more "Git-style" and easier too read when it is more similar to the rest of the code base:

test_expect_success 'reset - with @{-1} and no file named - or @{-1} should succeed' ' + git init new && + ( + cd new && + echo "Hey" >new_file && + git add new_file && + git commit -m "first_commit" && + git checkout -b new_branch && + >new_file && + git add new_file && + git reset - && + git status -uno >file1 && (Side-question: why "status -uno") typically "file" (or "file1") is used for user files, not for the "expected" or "actual" output.

Then we can compare the files directly in new/. And if we use new1, new2, new3, we don't need the explicit cleanup, as all tests are run in a "trash directory" which will be removed anyway.

In other words, we can write like this: (But this is for discussion, please read it as a suggestion)

+test_expect_success 'reset - with @{-1} and no file named - or @{-1} should succeed' ' + git init new3 && + ( + cd new3 && + echo "Hey" >new_file && + git add new_file && + git commit -m "first_commit" && + git checkout -b new_branch && + >new_file && + git add new_file && + git reset - && + git status -uno >expected && + git add new_file && + git reset @{-1} && + git status -uno >actual + test_cmp expected actual + ) +'

Previous: Sundararajan RNext: Eric Sunshine
Message 3 of 5 in “reset: add '-' shorthand for '@{-1}'”
  1. 1/2 reset: add '-' shorthand for '@{-1}'Sundararajan R, Mar 10, 2015
  2. 2/2 reset: add tests for git reset -Sundararajan R, Mar 10, 2015
  3. Torsten BögershausenMar 10, 2015
  4. Eric SunshineMar 10, 2015
  5. Eric SunshineMar 10, 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.