Thread (1 message) 1 message, 1 author, 2017-05-11

Re: [PATCH v2 3/3] git-filter-branch: make the error msg when missing branch more open

From: Junio C Hamano <hidden>
Date: 2017-05-11 03:53:20

Jean-Noel Avila [off-list ref] writes:
quoted hunk
git-filter-branch requires the specification of a branch by one way or
another. If no branch appears to have been specified, we know the user
got the usage wrong but we don't know what they were trying to do ---
e.g. maybe they specified the ref to rewrite but in the wrong place.

The safest solution is to just print the usage in this case.

Signed-off-by: Jean-Noel Avila <redacted>
---
 git-filter-branch.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 2b8cdba15..bda2bae23 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -239,7 +239,7 @@ git rev-parse --no-flags --revs-only --symbolic-full-name \
 sed -e '/^^/d' "$tempdir"/raw-heads >"$tempdir"/heads
 
 test -s "$tempdir"/heads ||
-	die "Which ref do you want to rewrite?"
+	usage
 
 GIT_INDEX_FILE="$(pwd)/../index"
 export GIT_INDEX_FILE
I tend to agree with Ævar on this one.  It is not apparent to the
end user after this change what exactly was wrong in the input; for
that matter, it is not even clear that the command is refusing to
run because it found problem with the input.  

Trying to move away from asking "I didn't get that, what did you
mean?" is one thing, and that can be done by saying "no ref to
rewrite given" or something.  We may want to make it into a more
"positive" nudge, telling the user what to do, e.g. "give me the
refs to rewrite."

Thanks.


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help