Skip to content

Commit

Permalink
Be more verbose when checkout takes a long time
Browse files Browse the repository at this point in the history
So I find it irritating when git thinks for a long time without telling me
what's taking so long. And by "long time" I definitely mean less than two
seconds, which is already way too long for me.

This hits me when doing a large pull and the checkout takes a long time,
or when just switching to another branch that is old and again checkout
takes a while.

Now, git read-tree already had support for the "-v" flag that does nice
updates about what's going on, but it was delayed by two seconds, and if
the thing had already done more than half by then it would be quiet even
after that, so in practice it meant that we migth be quiet for up to four
seconds. Much too long.

So this patch changes the timeout to just one second, which makes it much
more palatable to me.

The other thing this patch does is that "git checkout" now doesn't disable
the "-v" flag when doing its thing, and only disables the output when
given the -q flag.  When allowing "checkout -m" to fall back to a 3-way
merge, the users will see the error message from straight "checkout",
so we will tell them that we do fall back to make them look less scary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Feb 24, 2008
1 parent 9d561ad commit e854864
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions git-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,14 @@ then
git read-tree $v --reset -u $new
else
git update-index --refresh >/dev/null
merge_error=$(git read-tree -m -u --exclude-per-directory=.gitignore $old $new 2>&1) || (
case "$merge" in
'')
echo >&2 "$merge_error"
git read-tree $v -m -u --exclude-per-directory=.gitignore $old $new || (
case "$merge,$v" in
,*)
exit 1 ;;
1,)
;; # quiet
*)
echo >&2 "Falling back to 3-way merge..." ;;
esac

# Match the index to the working tree, and do a three-way.
Expand Down
2 changes: 1 addition & 1 deletion unpack-trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static void check_updates(struct cache_entry **src, int nr,
}

progress = start_progress_delay("Checking out files",
total, 50, 2);
total, 50, 1);
cnt = 0;
}

Expand Down

0 comments on commit e854864

Please sign in to comment.