Skip to content

Commit d34f715

Browse files
committed
Merge branch 'cc/bisect' (early part)
* 'cc/bisect' (early part): bisect: make "git bisect" use new "--next-all" bisect-helper function bisect: add "check_good_are_ancestors_of_bad" function bisect: implement the "check_merge_bases" function bisect: automatically sort sha1_array if needed when looking it up bisect: make skipped array functions more generic bisect: remove too much function nesting bisect: use new "struct argv_array" to prepare argv for "setup_revisions" bisect: store good revisions in a "sha1_array" bisect: implement "rev_argv_push" to fill an argv with revs bisect: use "sha1_array" to store skipped revisions am: simplify "sq" function by using "git rev-parse --sq-quote" bisect: use "git rev-parse --sq-quote" instead of a custom "sq" function rev-parse: add --sq-quote to shell quote arguments rev-list: remove stringed output flag from "show_bisect_vars" bisect--helper: remove "--next-vars" option as it is now useless bisect: use "git bisect--helper --next-exit" in "git-bisect.sh" bisect--helper: add "--next-exit" to output bisect results bisect: move common bisect functionality to "bisect_common" rev-list: refactor printing bisect vars rev-list: make "estimate_bisect_steps" non static
2 parents 3ed2421 + 0871984 commit d34f715

File tree

9 files changed

+494
-271
lines changed

9 files changed

+494
-271
lines changed

Documentation/git-rev-parse.txt

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ OPTIONS
3030
Only meaningful in `--parseopt` mode. Tells the option parser to echo
3131
out the first `--` met instead of skipping it.
3232

33+
--sq-quote::
34+
Use 'git-rev-parse' in shell quoting mode (see SQ-QUOTE
35+
section below). In contrast to the `--sq` option below, this
36+
mode does only quoting. Nothing else is done to command input.
37+
3338
--revs-only::
3439
Do not output flags and parameters not meant for
3540
'git-rev-list' command.
@@ -64,7 +69,8 @@ OPTIONS
6469
properly quoted for consumption by shell. Useful when
6570
you expect your parameter to contain whitespaces and
6671
newlines (e.g. when using pickaxe `-S` with
67-
'git-diff-\*').
72+
'git-diff-\*'). In contrast to the `--sq-quote` option,
73+
the command input is still interpreted as usual.
6874

6975
--not::
7076
When showing object names, prefix them with '{caret}' and
@@ -406,6 +412,33 @@ C? option C with an optional argument"
406412
eval `echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?`
407413
------------
408414

415+
SQ-QUOTE
416+
--------
417+
418+
In `--sq-quote` mode, 'git-rev-parse' echoes on the standard output a
419+
single line suitable for `sh(1)` `eval`. This line is made by
420+
normalizing the arguments following `--sq-quote`. Nothing other than
421+
quoting the arguments is done.
422+
423+
If you want command input to still be interpreted as usual by
424+
'git-rev-parse' before the output is shell quoted, see the `--sq`
425+
option.
426+
427+
Example
428+
~~~~~~~
429+
430+
------------
431+
$ cat >your-git-script.sh <<\EOF
432+
#!/bin/sh
433+
args=$(git rev-parse --sq-quote "$@") # quote user-supplied arguments
434+
command="git frotz -n24 $args" # and use it inside a handcrafted
435+
# command line
436+
eval "$command"
437+
EOF
438+
439+
$ sh your-git-script.sh "a b'c"
440+
------------
441+
409442
EXAMPLES
410443
--------
411444

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,6 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
12491249
$(QUIET_GEN)$(RM) $@ $@+ && \
12501250
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
12511251
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1252-
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
12531252
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
12541253
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
12551254
$@.sh >$@+ && \

0 commit comments

Comments
 (0)