From 25f3af3f9d351a3d50cb9fc2bf7bddf941e4bc58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Thu, 20 Jan 2011 21:12:20 +0100 Subject: [PATCH 1/2] Correctly report corrupted objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The errno check added in commit 3ba7a06 "A loose object is not corrupt if it cannot be read due to EMFILE" only checked for whether errno is not ENOENT and thus incorrectly treated "no error" as an error condition. Because of that, it never reached the code path that would report that the object is corrupted and instead caused funny errors like: fatal: failed to read object 333c4768ce595793fdab1ef3a036413e2a883853: Success So we have to extend the check to cover the case in which the object file was successfully read, but its contents are corrupted. Reported-by: Will Palmer Signed-off-by: Björn Steinbrink Signed-off-by: Junio C Hamano --- sha1_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sha1_file.c b/sha1_file.c index 1cafdfa617..d86a8db69a 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2141,7 +2141,7 @@ void *read_sha1_file_repl(const unsigned char *sha1, return data; } - if (errno != ENOENT) + if (errno && errno != ENOENT) die_errno("failed to read object %s", sha1_to_hex(sha1)); /* die if we replaced an object with one that does not exist */ From 8c0db6fd51cec5fd82cf4054818c0a1ca4a58f37 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 21 Jan 2011 12:37:34 -0600 Subject: [PATCH 2/2] Documentation: do not treat reset --keep as a special case The current treatment of "git reset --keep" emphasizes how it differs from --hard (treatment of local changes) and how it breaks down into plumbing (git read-tree -m -u HEAD followed by git update-ref HEAD ). This can discourage people from using it, since it might seem to be a complex or niche option. Better to emphasize what the --keep flag is intended for --- moving the index and worktree from one commit to another, like "git checkout" would --- so the reader can make a more informed decision about the appropriate situations in which to use it. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/git-reset.txt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index fd72976371..927ecee2f2 100644 --- a/Documentation/git-reset.txt +++ b/Documentation/git-reset.txt @@ -76,15 +76,10 @@ In other words, --merge does something like a 'git read-tree -u -m ', but carries forward unmerged index entries. --keep:: - Resets the index, updates files in the working tree that are - different between and HEAD, but keeps those - which are different between HEAD and the working tree (i.e. - which have local changes). + Resets index entries and updates files in the working tree that are + different between and HEAD. If a file that is different between and HEAD has local changes, reset is aborted. -+ -In other words, --keep does a 2-way merge between and HEAD followed by -'git reset --mixed '. -- If you want to undo a commit other than the latest on a branch,