shigeta@xxxxxxxxxxxxx writes: > From: Kazumasa Shigeta <shigeta@xxxxxxxxxxxxx> > > The --include-untracked option acts like the normal "git stash save --include-untracked --all" but it does not change anything in working directory. > It is inconvenient stash create does not have --include-untracked option however stash save has --include-untracked option. Please wrap long lines. > It fails when using message that start with dash. It is not compatible with now. I cannot quite parse this. What do you exactly mean by "It is not compatible with now"? Do you mean "with this patch, we break backward compatibility" and if so in what way? > diff --git a/git-stash.sh b/git-stash.sh > index 4798bcf..d636651 100755 > --- a/git-stash.sh > +++ b/git-stash.sh > @@ -57,8 +57,35 @@ clear_stash () { > } > > create_stash () { > - stash_msg="$1" > - untracked="$2" > + stash_msg= > + untracked= Broken indentation here? We indent with tabs, not runs of spaces. > + while test $# != 0 > + do > + case "$1" in > + -u|--include-untracked) > + untracked=untracked > + ;; > + -a|--all) > + untracked=all > + ;; > + --) > + shift > + break > + ;; > + -*) > + option="$1" > + eval_gettextln "error: unknown option for 'stash create': \$option > + To provide a message, use git stash create -- '\$option'" > + exit 1 > + ;; > + *) > + break > + ;; > + esac > + shift > + done > + stash_msg="$*" > > git update-index -q --refresh > if no_changes > @@ -260,8 +287,25 @@ save_stash () { > fi > test -f "$GIT_DIR/logs/$ref_stash" || > clear_stash || die "$(gettext "Cannot initialize stash")" > + untracked_opt= > + case "$untracked" in > + untracked) > + untracked_opt="--include-untracked" > + break > + ;; > + all) > + untracked_opt="--all" > + break > + ;; > + esac > + > + if test -z "$untracked_opt" > + then > + create_stash -- "$stash_msg" > + else > + create_stash "$untracked_opt" -- "$stash_msg" > + fi > - create_stash "$stash_msg" $untracked Wouldn't it suffice to do: create_stash ${untracked_opt:+"$untracked_opt"} -- "$stash_msg" without if/then/else/fi? > diff --git a/t/t3907-stash-create-include-untracked.sh b/t/t3907-stash-create-include-untracked.sh > new file mode 100755 > index 0000000..c28ed0f > --- /dev/null > +++ b/t/t3907-stash-create-include-untracked.sh > @@ -0,0 +1,286 @@ > +#!/bin/sh > +# > +# File: t3907-stash-create-include-untracked.sh > +# Author: shigeta > +# > +# Created on 2014/05/01, 13:13:15 Please discard the above lines. We can see what file it is in, and "git log" knows who wrote it when. You are only risking them to become obsolete and/or irrelevant over time without adding any real value. Don't we have existing test script for "stash"? If we do, shouldn't this patch be appending test pieces for new mode of operation it introduces to that existing script instead? > +test_description='Test git stash create --include-untracked and --all' > + > +. ./test-lib.sh > + > +cat > .gitignore <<EOF > +.gitignore > +ignored > +ignored.d/ > +EOF No SP between redirect operator and the filename. Quote EOF if your here-document does not need any variable interpolation to reduce mental burden from readers. I.e. cat >.gitignore <<\EOF foo bar EOF Also in newer test scripts we try to have as little commands to be executed outside test_expect_success set-up block as possible. The general structure of a new test script (if we do need to add one for this patch, which I doubt) should be along the lines of... test_description='...' . ./test-lib.sh test_expect_success setup ' the first test piece typically does all the set up && cat >.gitignore <<-\EOF && .gitignore ... EOF other initialisation necessary ' test_expect_success 'explain what this second test checks' ' piece specific setup && cat >expect <<-\EOF && expected output comes here EOF do the command >actual && test_cmp expect actual ' test_expect_success 'explain what this third test checks' ' ... test_done -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html