Re: git:// protocol over SSL/TLS
On Fri, Dec 27, 2013 at 08:25:16PM +0600, Sergey Sharybin wrote: Security in this case is about being sure everyone gets exactly the same repository as stored on the server, without any modifications to the sources cased by MITM. Besides security, HTTPS is more likely to work across different firewalls and proxies, since odd ports like 9418 are often blocked and HTTPS usually isn't subject to the weirdness of proxies (since they can't inspect it or modify it). As for smart http, this seems pretty much cool.However, we're currently using lighthttpd, so it might be an issue. We'll check on whether smart http is used there, and if not guess it wouldn't be a big deal to switch to apache. You can use Lighttpd if you like. See Documentation/git-http-backend.txt (or git http-backend --help). -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: Preventing unsigned commit/merge/tag
On Tue, Dec 31, 2013 at 12:49:01PM -0500, shawn wilson wrote: What's the best way of doing this? I'd prefer this be a pre hook on the server that rejects and the user has to rebase and fix their stuff. Though, if there's some way to make it easier for users not to mess up (other than an alias for everything which I'll probably do anyway) that would be useful. Any ideas? I don't believe the sign-on-rebase stuff ever got picked up, so at the moment this wouldn't be a good idea, since each and every commit would have to be manually amended. It seems it never made it from the list into Junio's queue whatsoever. And the always-sign code is only in pu at the moment. But if you wanted to anyway, you could simply use a pre-receive hook and walk the tree, verifying the signatures of each commit against some canonical list of approved keys. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v2 1/4] completion: prioritize ./git-completion.bash
On Fri, Jan 03, 2014 at 01:30:28PM +0530, Ramkumar Ramachandra wrote: To ease development, prioritize ./git-completion.bash over other standard system paths. Signed-off-by: Ramkumar Ramachandra artag...@gmail.com --- contrib/completion/git-completion.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh index fac5e71..6fca145 100644 --- a/contrib/completion/git-completion.zsh +++ b/contrib/completion/git-completion.zsh @@ -30,10 +30,10 @@ if [ -z $script ]; then local -a locations local e locations=( + $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash '/etc/bash_completion.d/git' # fedora, old debian '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian '/usr/share/bash-completion/git' # gentoo - $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash ) for e in $locations; do test -f $e script=$e break I'm not clear on this change. It looks like this loads git-completion.bash from the same directory as git-completion.zsh. Is this correct? Your commit message says ./, and if that's the case, it has the same security problems as putting . first in your PATH. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: Workflow on git with 2 branch with specifc code
On Fri, Jan 17, 2014 at 10:14:28AM -0200, Gordon Freeman wrote: Hello guys, im Gordon. I have a question about workflow with git that i dont know if im doing it right. I have 1 repo with 2 branchs the first is the master of the project. the second is a branch copy of the master but he need to have some specifc code because is code for a client. so, every time that i updade master i need to merge master with client branch and it give me conflicts of course that will hapen. Well if was just me who work on this 2 branchs it will be easy to fix the conflicts and let all work and shine. But whe have here, 10 people woking on master branch and some times code are lost on merge and we need to look on commits to search whats goin on. What i just asking here is if its correct the workflow that i do. If for some problem like this, the community have a standard resolution. Or if what im doing here is all wrong. There are many correct workflows. I personally use the workflow you've mentioned for the exact same reason (customizations for a client), but I'm the only developer on that repository. What you might try instead is a slightly different workflow. Have each developer create a feature branch to add a feature or fix a bug. Merge these into master as they become ready. Have a specific person or group of people be integrators, and have them merge master into the client branch as necessary, fixing up any conflicts. When conflicts are non-trivial, use pair programming or a review process to ensure that the result is good. We use a similar workflow at my regular employer, and it is generally very successful for a department with 45 employees. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v4 08/23] ewah: compressed bitmap implementation
On Thu, Jan 23, 2014 at 03:26:45PM -0500, Jeff King wrote: Looking over the format, I think the only thing preventing 4-byte alignment is the 1-byte XOR-offset and 1-byte flags field for each bitmap. If we ever have a v2, we could pad the sum of those out to 4 bytes. Is 4-byte alignment enough? We do treat the actual data as 64-bit integers. I wonder if that would have problems on Sparc64, for example. Yes, it will. SPARC requires all loads be naturally aligned (4-byte to an address that's a multiple of 4, 8-byte to a multiple of 8, and so on). In general, architectures that do not support unaligned access require natural alignment for all quantities. Also, even on architectures where the kernel can fix these alignment issues up, the cost of doing so is a two context switches (in and out of the kernel), servicing the trap, two loads, some shifts and rotates, and a kernel message, so many people disable alignment fixups. I know it made things extremely slow on Alpha. ARM is even more fun since if you don't take the trap, it loads the data rotated, so the load happens, it just silently returns the wrong data. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH v2 6/9] rebase: don't try to match -M option
From: Nicolas Vigier bo...@mars-attacks.org The -M option does not exist in OPTIONS_SPEC, so there is no use to try to find it. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-rebase.sh b/git-rebase.sh index d1835ba..3b55211 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -267,7 +267,7 @@ do --no-fork-point) fork_point= ;; - -M|-m) + -m) do_merge=t ;; -X) -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/9] git-sh-setup.sh: add variable to use the stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org If the variable $OPTIONS_STUCKLONG is not empty, then rev-parse option parsing is done in --stuck-long mode. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- contrib/examples/git-checkout.sh | 1 + contrib/examples/git-clean.sh| 1 + contrib/examples/git-clone.sh| 1 + contrib/examples/git-merge.sh| 1 + contrib/examples/git-repack.sh | 1 + contrib/git-resurrect.sh | 1 + git-am.sh| 1 + git-instaweb.sh | 1 + git-quiltimport.sh | 1 + git-rebase.sh| 1 + git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ 12 files changed, 13 insertions(+) diff --git a/contrib/examples/git-checkout.sh b/contrib/examples/git-checkout.sh index 1a7689a..d7507ed 100755 --- a/contrib/examples/git-checkout.sh +++ b/contrib/examples/git-checkout.sh @@ -1,6 +1,7 @@ #!/bin/sh OPTIONS_KEEPDASHDASH=t +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git-checkout [options] [branch] [paths...] -- diff --git a/contrib/examples/git-clean.sh b/contrib/examples/git-clean.sh index 01c95e9..9d881cd 100755 --- a/contrib/examples/git-clean.sh +++ b/contrib/examples/git-clean.sh @@ -4,6 +4,7 @@ # OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git-clean [options] paths... diff --git a/contrib/examples/git-clone.sh b/contrib/examples/git-clone.sh index 547228e..ea4757d 100755 --- a/contrib/examples/git-clone.sh +++ b/contrib/examples/git-clone.sh @@ -8,6 +8,7 @@ # See git-sh-setup why. unset CDPATH +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git-clone [options] [--] repo [dir] -- diff --git a/contrib/examples/git-merge.sh b/contrib/examples/git-merge.sh index a5e42a9..f0243d5 100755 --- a/contrib/examples/git-merge.sh +++ b/contrib/examples/git-merge.sh @@ -4,6 +4,7 @@ # OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git merge [options] remote... git merge [options] msg HEAD remote diff --git a/contrib/examples/git-repack.sh b/contrib/examples/git-repack.sh index 7579331..fd5ced5 100755 --- a/contrib/examples/git-repack.sh +++ b/contrib/examples/git-repack.sh @@ -4,6 +4,7 @@ # OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git repack [options] -- diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh index a4ed4c3..d7e97bb 100755 --- a/contrib/git-resurrect.sh +++ b/contrib/git-resurrect.sh @@ -10,6 +10,7 @@ is rather slow but allows you to resurrect other people's topic branches. OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git resurrect $USAGE -- diff --git a/git-am.sh b/git-am.sh index bbea430..a3b6f98 100755 --- a/git-am.sh +++ b/git-am.sh @@ -4,6 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git am [options] [(mbox|Maildir)...] git am [options] (--continue | --skip | --abort) diff --git a/git-instaweb.sh b/git-instaweb.sh index e93a238..4aa3eb8 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -5,6 +5,7 @@ PERL='@@PERL@@' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git instaweb [options] (--start | --stop | --restart) -- diff --git a/git-quiltimport.sh b/git-quiltimport.sh index 8e17525..167d79f 100755 --- a/git-quiltimport.sh +++ b/git-quiltimport.sh @@ -1,5 +1,6 @@ #!/bin/sh OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git quiltimport [options] -- diff --git a/git-rebase.sh b/git-rebase.sh index 8a3efa2..c1f98ae 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -5,6 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git rebase [-i] [options] [--exec cmd] [--onto newbase] [upstream] [branch] git rebase [-i] [options] [--exec cmd] [--onto newbase] --root [branch] diff --git a/git-request-pull.sh b/git-request-pull.sh index fe21d5d..cf4f150 100755 --- a/git-request-pull.sh +++ b/git-request-pull.sh @@ -9,6 +9,7 @@ LONG_USAGE='Summarizes the changes between two commits to the standard output, and includes the given URL in the generated summary.' SUBDIRECTORY_OK='Yes' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC='git request-pull [options] start url [end] -- pshow patch text as well diff --git a/git-sh-setup.sh b/git-sh-setup.sh index fffa3c7..5f28b32 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -72,6 +72,8 @@ if test -n $OPTIONS_SPEC; then parseopt_extra= [ -n $OPTIONS_KEEPDASHDASH ] parseopt_extra=--keep-dashdash + [ -n $OPTIONS_STUCKLONG ] + parseopt_extra=$parseopt_extra --stuck-long eval $( echo $OPTIONS_SPEC | -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 9/9] pull: add the --gpg-sign option.
git merge already allows us to sign commits, and git rebase has recently learned how to do so as well. Teach git pull to parse the -S/--gpg-sign option and pass this along to merge or rebase, as appropriate. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-pull.sh | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/git-pull.sh b/git-pull.sh index 0a5aa2c..4164dac 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -138,6 +138,15 @@ do --no-verify-signatures) verify_signatures=--no-verify-signatures ;; + --gpg-sign|-S) + gpg_sign_args=-S + ;; + --gpg-sign=*) + gpg_sign_args=-S${1#--gpg-sign=} + ;; + -S*) + gpg_sign_args=-S${1#-S} + ;; --d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run) dry_run=--dry-run ;; @@ -305,11 +314,13 @@ merge_name=$(git fmt-merge-msg $log_arg $GIT_DIR/FETCH_HEAD) || exit case $rebase in true) eval=git-rebase $diffstat $strategy_args $merge_args $rebase_args $verbosity + eval=$eval $gpg_sign_args eval=$eval --onto $merge_head ${oldremoteref:-$merge_head} ;; *) eval=git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only - eval=$eval $log_arg $strategy_args $merge_args $verbosity $progress + eval=$eval $log_arg $strategy_args $merge_args $verbosity $progress + eval=$eval $gpg_sign_args eval=$eval \\$merge_name\ HEAD $merge_head ;; esac -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 5/9] rebase: remove useless arguments check
From: Nicolas Vigier bo...@mars-attacks.org Remove a check on the number of arguments for --onto and -x options. It is not possible for $# to be = 2 at this point : - if --onto or -x has an argument, git rev-parse --parseopt will provide something like this : set -- --onto 'x' -- when parsing the --onto option, $# will be 3 or more if there are other options. - if --onto or -x doesn't have an argument, git rev-parse --parseopt will exit with an error and display usage information. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index c1f98ae..d1835ba 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -238,12 +238,10 @@ do action=${1##--} ;; --onto) - test 2 -le $# || usage onto=$2 shift ;; -x) - test 2 -le $# || usage cmd=${cmd}exec $2${LF} shift ;; -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/9] cherry-pick, revert: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-cherry-pick.txt | 7 ++- Documentation/git-revert.txt | 6 +- builtin/revert.c | 2 ++ sequencer.c | 11 +++ sequencer.h | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index c205d23..f1e6b2f 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS [verse] -'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... +'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] + [-S[keyid]] commit... 'git cherry-pick' --continue 'git cherry-pick' --quit 'git cherry-pick' --abort @@ -100,6 +101,10 @@ effect to your index in a row. --signoff:: Add Signed-off-by line at the end of the commit message. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + --ff:: If the current HEAD is the same as the parent of the cherry-pick'ed commit, then a fast forward to this commit will diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index 2de67a5..9eb83f0 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -8,7 +8,7 @@ git-revert - Revert some existing commits SYNOPSIS [verse] -'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] commit... +'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[keyid]] commit... 'git revert' --continue 'git revert' --quit 'git revert' --abort @@ -80,6 +80,10 @@ more details. This is useful when reverting more than one commits' effect to your index in a row. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + -s:: --signoff:: Add Signed-off-by line at the end of the commit message. diff --git a/builtin/revert.c b/builtin/revert.c index 87659c9..065d88d 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_STRING(0, strategy, opts-strategy, N_(strategy), N_(merge strategy)), OPT_CALLBACK('X', strategy-option, opts, N_(option), N_(option for merge strategy), option_parse_x), + { OPTION_STRING, 'S', gpg-sign, opts-gpg_sign, N_(key id), + N_(GPG sign commit), PARSE_OPT_OPTARG, NULL, (intptr_t) }, OPT_END(), OPT_END(), OPT_END(), diff --git a/sequencer.c b/sequencer.c index 90cac7b..bde5f04 100644 --- a/sequencer.c +++ b/sequencer.c @@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, { struct argv_array array; int rc; + char *gpg_sign; argv_array_init(array); argv_array_push(array, commit); argv_array_push(array, -n); + if (opts-gpg_sign) { + gpg_sign = xmalloc(3 + strlen(opts-gpg_sign)); + sprintf(gpg_sign, -S%s, opts-gpg_sign); + argv_array_push(array, gpg_sign); + free(gpg_sign); + } if (opts-signoff) argv_array_push(array, -s); if (!opts-edit) { @@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data) opts-mainline = git_config_int(key, value); else if (!strcmp(key, options.strategy)) git_config_string(opts-strategy, key, value); + else if (!strcmp(key, options.gpg-sign)) + git_config_string(opts-gpg_sign, key, value); else if (!strcmp(key, options.strategy-option)) { ALLOC_GROW(opts-xopts, opts-xopts_nr + 1, opts-xopts_alloc); opts-xopts[opts-xopts_nr++] = xstrdup(value); @@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts) } if (opts-strategy) git_config_set_in_file(opts_file, options.strategy, opts-strategy); + if (opts-gpg_sign) + git_config_set_in_file(opts_file, options.gpg-sign, opts-gpg_sign); if (opts-xopts) { int i; for (i = 0; i opts-xopts_nr; i++) diff --git a/sequencer.h b/sequencer.h index 1fc22dc..db43e9c 100644 --- a/sequencer.h +++ b/sequencer.h @@ -37,6 +37,8 @@ struct replay_opts { int mainline; + const char *gpg_sign; + /* Merge strategy */ const char *strategy; const char **xopts; -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo
[PATCH v2 7/9] rebase: parse options in stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org There is no functionnal change. The reason for this change is to be able to add a new option taking an optional argument. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 50 ++ 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index 3b55211..842d7d4 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -5,7 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC=\ git rebase [-i] [options] [--exec cmd] [--onto newbase] [upstream] [branch] git rebase [-i] [options] [--exec cmd] [--onto newbase] --root [branch] @@ -237,21 +237,19 @@ do test $total_argc -eq 2 || usage action=${1##--} ;; - --onto) - onto=$2 - shift + --onto=*) + onto=${1#--onto=} ;; - -x) - cmd=${cmd}exec $2${LF} - shift + --exec=*) + cmd=${cmd}exec ${1#--exec=}${LF} ;; - -i) + --interactive) interactive_rebase=explicit ;; - -k) + --keep-empty) keep_empty=yes ;; - -p) + --preserve-merges) preserve_merges=t test -z $interactive_rebase interactive_rebase=implied ;; @@ -267,21 +265,19 @@ do --no-fork-point) fork_point= ;; - -m) + --merge) do_merge=t ;; - -X) - shift - strategy_opts=$strategy_opts $(git rev-parse --sq-quote --$1) + --strategy-option=*) + strategy_opts=$strategy_opts $(git rev-parse --sq-quote --${1#--strategy-option=}) do_merge=t test -z $strategy strategy=recursive ;; - -s) - shift - strategy=$1 + --strategy=*) + strategy=${1#--strategy=} do_merge=t ;; - -n) + --no-stat) diffstat= ;; --stat) @@ -290,21 +286,20 @@ do --autostash) autostash=true ;; - -v) + --verbose) verbose=t diffstat=t GIT_QUIET= ;; - -q) + --quiet) GIT_QUIET=t git_am_opt=$git_am_opt -q verbose= diffstat= ;; - --whitespace) - shift - git_am_opt=$git_am_opt --whitespace=$1 - case $1 in + --whitespace=*) + git_am_opt=$git_am_opt --whitespace=${1#--whitespace=} + case ${1#--whitespace=} in fix|strip) force_rebase=t ;; @@ -317,14 +312,13 @@ do git_am_opt=$git_am_opt $1 force_rebase=t ;; - -C) - shift - git_am_opt=$git_am_opt -C$1 + -C*) + git_am_opt=$git_am_opt $1 ;; --root) rebase_root=t ;; - -f|--no-ff) + --force-rebase|--no-ff) force_rebase=t ;; --rerere-autoupdate|--no-rerere-autoupdate) -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/9] am: parse options in stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org There is no functional change. The reason for this change is to be able to add a new option taking an optional argument. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-am.sh | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/git-am.sh b/git-am.sh index a3b6f98..020abf6 100755 --- a/git-am.sh +++ b/git-am.sh @@ -4,7 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC=\ git am [options] [(mbox|Maildir)...] git am [options] (--continue | --skip | --abort) @@ -414,14 +414,14 @@ it will be removed. Please do not use it anymore. abort=t ;; --rebasing) rebasing=t threeway=t ;; - --resolvemsg) - shift; resolvemsg=$1 ;; - --whitespace|--directory|--exclude|--include) - git_apply_opt=$git_apply_opt $(sq $1=$2); shift ;; - -C|-p) - git_apply_opt=$git_apply_opt $(sq $1$2); shift ;; - --patch-format) - shift ; patch_format=$1 ;; + --resolvemsg=*) + resolvemsg=${1#--resolvemsg=} ;; + --whitespace=*|--directory=*|--exclude=*|--include=*) + git_apply_opt=$git_apply_opt $(sq $1) ;; + -C*|-p*) + git_apply_opt=$git_apply_opt $(sq $1) ;; + --patch-format=*) + patch_format=${1#--patch-format=} ;; --reject|--ignore-whitespace|--ignore-space-change) git_apply_opt=$git_apply_opt $1 ;; --committer-date-is-author-date) -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/9] add --gpg-sign to rebase and pull
This series was posted to the list some time back, but it fell through the cracks. This is a re-send of Nicolas Vigier's work with an additional patch that adds --gpg-sign to pull as well. I added my sign-off to his patches because SubmittingPatches (section (c)) seems to imply that I should, although I can rebase it out if it's a problem. I've been running with this patch set for some time now, and haven't found any issues, although I wouldn't recommend doing large rebases without a gpg-agent running. I'm happy to fix any issues that come up in order to move this series as expeditiously as possible, but seeing as I'm in San Francisco at the moment, re-rolls might be delayed through the next few days. Nicolas Vigier (8): cherry-pick, revert: add the --gpg-sign option git-sh-setup.sh: add variable to use the stuck-long mode am: parse options in stuck-long mode am: add the --gpg-sign option rebase: remove useless arguments check rebase: don't try to match -M option rebase: parse options in stuck-long mode rebase: add the --gpg-sign option brian m. carlson (1): pull: add the --gpg-sign option. Documentation/git-am.txt | 6 +++- Documentation/git-cherry-pick.txt | 7 - Documentation/git-rebase.txt | 4 +++ Documentation/git-revert.txt | 6 +++- builtin/revert.c | 2 ++ contrib/examples/git-checkout.sh | 1 + contrib/examples/git-clean.sh | 1 + contrib/examples/git-clone.sh | 1 + contrib/examples/git-merge.sh | 1 + contrib/examples/git-repack.sh| 1 + contrib/git-resurrect.sh | 1 + git-am.sh | 26 ++-- git-instaweb.sh | 1 + git-pull.sh | 13 +++- git-quiltimport.sh| 1 + git-rebase--am.sh | 8 +++-- git-rebase--interactive.sh| 32 git-rebase--merge.sh | 2 +- git-rebase.sh | 62 +-- git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ sequencer.c | 11 +++ sequencer.h | 2 ++ 23 files changed, 134 insertions(+), 58 deletions(-) -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 8/9] rebase: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-rebase.txt | 4 git-rebase--am.sh| 8 +--- git-rebase--interactive.sh | 32 git-rebase--merge.sh | 2 +- git-rebase.sh| 11 +++ 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 2889be6..2a93c64 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -281,6 +281,10 @@ which makes little sense. specified, `-s recursive`. Note the reversal of 'ours' and 'theirs' as noted above for the `-m` option. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + -q:: --quiet:: Be quiet. Implies --no-stat. diff --git a/git-rebase--am.sh b/git-rebase--am.sh index a4f683a..df46f4c 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -6,7 +6,8 @@ case $action in continue) - git am --resolved --resolvemsg=$resolvemsg + git am --resolved --resolvemsg=$resolvemsg \ + ${gpg_sign_opt:+$gpg_sign_opt} move_to_original_branch return ;; @@ -26,7 +27,7 @@ then # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick # makes this easy - git cherry-pick --allow-empty $revisions + git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} --allow-empty $revisions ret=$? else rm -f $GIT_DIR/rebased-patches @@ -60,7 +61,8 @@ else return $? fi - git am $git_am_opt --rebasing --resolvemsg=$resolvemsg $GIT_DIR/rebased-patches + git am $git_am_opt --rebasing --resolvemsg=$resolvemsg \ + ${gpg_sign_opt:+$gpg_sign_opt} $GIT_DIR/rebased-patches ret=$? rm -f $GIT_DIR/rebased-patches diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 43c19e0..73d32dd 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -181,7 +181,7 @@ exit_with_patch () { git rev-parse --verify HEAD $amend warn You can amend the commit now, with warn - warn git commit --amend + warn git commit --amend $gpg_sign_opt warn warn Once you are satisfied with your changes, run warn @@ -248,7 +248,8 @@ pick_one () { test -d $rewritten pick_one_preserving_merges $@ return - output eval git cherry-pick $strategy_args $empty_args $ff $@ + output eval git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} \ + $strategy_args $empty_args $ff $@ } pick_one_preserving_merges () { @@ -359,7 +360,8 @@ pick_one_preserving_merges () { echo $sha1 $(git rev-parse HEAD^0) $rewritten_list ;; *) - output eval git cherry-pick $strategy_args $@ || + output eval git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} \ + $strategy_args $@ || die_with_patch $sha1 Could not pick $sha1 ;; esac @@ -470,7 +472,8 @@ do_pick () { --no-post-rewrite -n -q -C $1 pick_one -n $1 git commit --allow-empty --allow-empty-message \ - --amend --no-post-rewrite -n -q -C $1 || + --amend --no-post-rewrite -n -q -C $1 \ + ${gpg_sign_opt:+$gpg_sign_opt} || die_with_patch $1 Could not apply $1... $2 else pick_one $1 || @@ -497,7 +500,7 @@ do_next () { mark_action_done do_pick $sha1 $rest - git commit --amend --no-post-rewrite || { + git commit --amend --no-post-rewrite ${gpg_sign_opt:+$gpg_sign_opt} || { warn Could not amend commit after successfully picking $sha1... $rest warn This is most likely due to an empty commit message, or the pre-commit hook warn failed. If the pre-commit hook failed, you may need to resolve the issue before @@ -542,19 +545,22 @@ do_next () { squash|s|fixup|f) # This is an intermediate commit; its message will only be # used in case of trouble. So use the long version: - do_with_author output git commit --amend --no-verify -F $squash_msg || + do_with_author output git commit --amend --no-verify -F $squash_msg \ + ${gpg_sign_opt:+$gpg_sign_opt
[PATCH v2 4/9] am: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-am.txt | 6 +- git-am.sh| 9 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 54d8461..17924d0 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -14,7 +14,7 @@ SYNOPSIS [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=option] [-Cn] [-pn] [--directory=dir] [--exclude=path] [--include=path] [--reject] [-q | --quiet] -[--[no-]scissors] +[--[no-]scissors] [-S[keyid]] [(mbox | Maildir)...] 'git am' (--continue | --skip | --abort) @@ -119,6 +119,10 @@ default. You can use `--no-utf8` to override this. Skip the current patch. This is only meaningful when restarting an aborted patch. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + --continue:: -r:: --resolved:: diff --git a/git-am.sh b/git-am.sh index 020abf6..dccbae2 100755 --- a/git-am.sh +++ b/git-am.sh @@ -38,6 +38,7 @@ abort restore the original branch and abort the patching operation. committer-date-is-author-datelie about committer date ignore-date use current timestamp for author date rerere-autoupdate update the index with reused conflict resolution if possible +S,gpg-sign? GPG-sign commits rebasing* (internal use for git-rebase) . git-sh-setup @@ -375,6 +376,7 @@ git_apply_opt= committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= +gpg_sign_opt= if test $(git config --bool --get am.keepcr) = true then @@ -436,6 +438,10 @@ it will be removed. Please do not use it anymore. keepcr=t ;; --no-keep-cr) keepcr=f ;; + --gpg-sign) + gpg_sign_opt=-S ;; + --gpg-sign=*) + gpg_sign_opt=-S${1#--gpg-sign=} ;; --) shift; break ;; *) @@ -900,7 +906,8 @@ did you forget to use 'git add'? GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE export GIT_COMMITTER_DATE fi - git commit-tree $tree ${parent:+-p} $parent $dotest/final-commit + git commit-tree ${gpg_sign_opt:+$gpg_sign_opt} $tree ${parent:+-p} $parent \ + $dotest/final-commit ) git update-ref -m $GIT_REFLOG_ACTION: $FIRSTLINE HEAD $commit $parent || stop_here $this -- 1.9.rc0.1002.gd081c64.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/9] cherry-pick, revert: add the --gpg-sign option
On Fri, Jan 24, 2014 at 01:00:06PM -0800, Junio C Hamano wrote: brian m. carlson sand...@crustytoothpaste.net writes: +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + Does this accept --no-gpg-sign? If not, shouldn't it? It does not. I took Nicolas's patches from the list and applied them to master, so nothing from next is there, including the commit.gpgsign stuff. Would you prefer I rebased them on next instead? diff --git a/sequencer.c b/sequencer.c index 90cac7b..bde5f04 100644 --- a/sequencer.c +++ b/sequencer.c @@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, { struct argv_array array; int rc; + char *gpg_sign; argv_array_init(array); argv_array_push(array, commit); argv_array_push(array, -n); + if (opts-gpg_sign) { + gpg_sign = xmalloc(3 + strlen(opts-gpg_sign)); + sprintf(gpg_sign, -S%s, opts-gpg_sign); + argv_array_push(array, gpg_sign); + free(gpg_sign); + } Here you would need to invent a new way to propagate --no-gpg-sign to subsequent invocations, I think. Probably. It wouldn't be too terribly difficult. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] repack.c: chmod +w before rename()
On Fri, Jan 24, 2014 at 10:05:14PM +0100, Torsten Bögershausen wrote: commit a1bbc6c0 repack: rewrite the shell script in C introduced a possible regression, when a Git repo is located on a Windows network share. When git gc is called on an already packed repository, it could fail like this: fatal: renaming '.git/objects/pack/.tmp-xyz.pack' failed: Permission denied Temporary *.pack and *.idx files remain in .git/objects/pack/ In a1bbc6c0 the rename() function replaced the mv -f shell command. Obviously the -f option can also override a read-only file but rename() can not on a network share. Make the C-code to work similar to the shell script, by making the files writable before calling rename(). Another solution could be to do the chmod +x in mingw_rename(). This may be done in another commit, because a) It improves git gc only when Git for Windows is used on the client machine b) Windows refuses to delete a file when the file is read-only. So setting a file to read-only under Windows is a way for a user to protect it from being deleted. Changing the behaviour of rename() globally may not be what we want. Reported-by: Jochen Haag zwanzi...@googlemail.com Signed-off-by: Torsten Bögershausen tbo...@web.de --- builtin/repack.c | 4 1 file changed, 4 insertions(+) diff --git a/builtin/repack.c b/builtin/repack.c index ba66c6e..033b4c2 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -324,6 +324,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix) statbuffer.st_mode = ~(S_IWUSR | S_IWGRP | S_IWOTH); chmod(fname_old, statbuffer.st_mode); } + if (!stat(fname, statbuffer)) { + statbuffer.st_mode |= (S_IWUSR | S_IWGRP | S_IWOTH); + chmod(fname, statbuffer.st_mode); + } Are we sure that the file in question can never be a symlink? Because if it is, we'll end up changing the permissions on the wrong file. In general, I'm wary of changing permissions on a file to suit Windows's rename because of the symlink issue and the security issues that can result. Hard links probably have the same issue. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] repack.c: chmod +w before rename()
On Fri, Jan 24, 2014 at 11:24:36PM +0100, Johannes Schindelin wrote: In general, I'm wary of changing permissions on a file to suit Windows's rename because of the symlink issue and the security issues that can result. I agree on the Windows issue. I personally feel that if Windows needs help to change permissions for a rename, that code should only ever be used on Windows. Doesn't mingw_rename automatically do this anyway, and if it doesn't, shouldn't we put the code there instead? Furthermore, it makes me very nervous to make the file 666. Isn't 644 enough? Hard links probably have the same issue. No, hard links have their own permissions. If you change the permissions on a hardlink, any other hardlinks to the same content are unaffected. Not according to link(2): This new name may be used exactly as the old one for any operation; both names refer to the same file (and so have the same permissions and ownership) and it is impossible to tell which name was the original. My testing confirms this. More importantly, while one might not want to symlink a pack frequently, git clone -l does use hard links. This means that if a local clone is made somewhere, and then the original repository is repacked and hits this case, the clone is now vulnerable to tampering by a malicious user (assuming that user can read the appropriate directory). So unless I'm reading this wrong, this patch would cause security problems on all Unix systems. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v2 8/9] rebase: add the --gpg-sign option
On Mon, Jan 27, 2014 at 03:36:44PM -0800, Junio C Hamano wrote: brian m. carlson sand...@crustytoothpaste.net writes: diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 43c19e0..73d32dd 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -181,7 +181,7 @@ exit_with_patch () { git rev-parse --verify HEAD $amend warn You can amend the commit now, with warn - warn git commit --amend + warn git commit --amend $gpg_sign_opt I think this is meant to be cut--pasted, so you may have to quote the RHS of --gpg-sign=key (or the key part of -Skey). The same comment as the one for 'git pull' patch applies around 'eval's in the remainder of the patch. @@ -248,7 +248,8 @@ pick_one () { test -d $rewritten pick_one_preserving_merges $@ return - output eval git cherry-pick $strategy_args $empty_args $ff $@ + output eval git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} \ + $strategy_args $empty_args $ff $@ } [rest snipped] Thanks. Thanks for the review. I'll get working on a reroll. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: C standard compliance?
On Wed, Jan 29, 2014 at 09:52:45PM +0100, David Kastrup wrote: Junio C Hamano gits...@pobox.com writes: Hmm... if you were to implement a set of pointers in such a way that you can cheaply tell if an unknown pointer belongs to that set, you would use a hashtable, keyed with something that is derived from the value of the pointer casted to uintptr_t, I would think. The types intptr_t and uintptr_t are optional in ISO/IEC 9899:1999 (C99). So it would seem that I'd be covering fewer cases rather than more in that manner. I think we already use uintptr_t in the codebase, and if it's not present, we typedef it to unsigned long. So I think it should be fine (and well-defined) if instead of doing void *p, *q; ... if (p q) ... you do: void *p, *q; ... if ((uintptr_t)p (uintptr_t)q) ... Then on those systems where the compiler has some bizarre undefined behavior checking, the code will work. On systems that don't have uintptr_t, the compiler is probably not smart enough to perform such a check anyway. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: Re* [RFC PATCH 2/1] Make request-pull able to take a refspec of form local:remote
On Wed, Jan 29, 2014 at 03:34:32PM -0800, Junio C Hamano wrote: The previous two steps were meant to stop promoting the explicit refname the user gave to the command to a different ref that points at it. Most notably, we no longer substitute a branch name the user used with a name of the tqag that points at the commit at the tip of s/tqag/tag/ -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Performance regression in git fetch between 1.8.3.4 and 1.8.5.3
At work, we recently upgraded our git version from 1.8.3.4 to 1.8.5.3. We've noticed a significant performance regression in git fetch. The numbers below are for an up-to-date branch (that is, no data is actually being fetched) for a git-over-ssh remote on our gitorious server. This is an auxiliary repository, so its size is probably between 6-7 GiB. It does not have an especially large number of refs, but is a clone of our main repository. Other than the new version, the only difference is that 1.8.5.3 is built against libpcre. These are both running on the same CentOS 6 system; literally the only difference is installing one RPM or the other. 1.8.3.4: brianc ok # for i in `seq 1 3`; do time git fetch; done git fetch 0.86s user 0.18s system 78% cpu 1.314 total git fetch 0.88s user 0.19s system 79% cpu 1.348 total git fetch 0.84s user 0.18s system 78% cpu 1.299 total 1.8.5.3: brianc ok # for i in `seq 1 3`; do time git fetch; done git fetch 17.11s user 1.22s system 98% cpu 18.652 total git fetch 16.74s user 1.24s system 98% cpu 18.286 total git fetch 17.78s user 1.35s system 98% cpu 19.446 total Does anyone have any idea what might be causing this? -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: Performance regression in git fetch between 1.8.3.4 and 1.8.5.3
On Fri, Jan 31, 2014 at 04:35:05PM -0500, Jeff King wrote: On Fri, Jan 31, 2014 at 09:02:15PM +, brian m. carlson wrote: At work, we recently upgraded our git version from 1.8.3.4 to 1.8.5.3. We've noticed a significant performance regression in git fetch. The numbers below are for an up-to-date branch (that is, no data is actually being fetched) for a git-over-ssh remote on our gitorious server. Is it better with v1.9-rc1? There was a slowdown in v1.8.4.2 that I addressed with commit 200abe7 (which is slated for v1.9). Yes. The time is much lower with 1.9-rc1: brianc ok # for i in `seq 1 3`; do time git fetch; done git fetch 0.90s user 0.18s system 74% cpu 1.447 total git fetch 0.88s user 0.20s system 74% cpu 1.456 total git fetch 0.88s user 0.19s system 74% cpu 1.438 total I'll open a case to get it updated once 1.9 is finally released. Thanks for your suggestion. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v2 9/9] pull: add the --gpg-sign option.
On Mon, Jan 27, 2014 at 03:31:36PM -0800, Junio C Hamano wrote: ... but here it is used as if it is properly quoted so that later eval $eval will take it as a single argument. git pull --gpg-sign='foo bar' will probably ask the command to use 'foo' as the signer key id, with 'bar' as an extra, unknown token on the command line of the underlying 'git merge', I suspect. A git rev-parse --sq-quote in the earlier hunk may be all it takes to fix it. Yes, you were correct that that was broken, and yes, it turns out that your fix is sufficient. It also happens to fix the issue where the help text is improperly quoted. With your suggested fix, it is now quoted (ugly, but quoted): Stopped at aba3d3ff83b59627adbdafe1b334a46ed5b7ec17... am: add the --gpg-sign option You can amend the commit now, with git commit --amend '-Sbrian m. carlson sand...@crustytoothpaste.net' Since I expect most users are going to use -S, either because they have a key specifically specified in .gitconfig, or because the default key is the right thing anyway, I don't see this as a huge problem. I think I'll probably end up fixing it anyway and then send out the reroll. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH v3 5/9] rebase: remove useless arguments check
From: Nicolas Vigier bo...@mars-attacks.org Remove a check on the number of arguments for --onto and -x options. It is not possible for $# to be = 2 at this point : - if --onto or -x has an argument, git rev-parse --parseopt will provide something like this : set -- --onto 'x' -- when parsing the --onto option, $# will be 3 or more if there are other options. - if --onto or -x doesn't have an argument, git rev-parse --parseopt will exit with an error and display usage information. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index c1f98ae..d1835ba 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -238,12 +238,10 @@ do action=${1##--} ;; --onto) - test 2 -le $# || usage onto=$2 shift ;; -x) - test 2 -le $# || usage cmd=${cmd}exec $2${LF} shift ;; -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 7/9] rebase: parse options in stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org There is no functionnal change. The reason for this change is to be able to add a new option taking an optional argument. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 50 ++ 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index 3b55211..842d7d4 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -5,7 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC=\ git rebase [-i] [options] [--exec cmd] [--onto newbase] [upstream] [branch] git rebase [-i] [options] [--exec cmd] [--onto newbase] --root [branch] @@ -237,21 +237,19 @@ do test $total_argc -eq 2 || usage action=${1##--} ;; - --onto) - onto=$2 - shift + --onto=*) + onto=${1#--onto=} ;; - -x) - cmd=${cmd}exec $2${LF} - shift + --exec=*) + cmd=${cmd}exec ${1#--exec=}${LF} ;; - -i) + --interactive) interactive_rebase=explicit ;; - -k) + --keep-empty) keep_empty=yes ;; - -p) + --preserve-merges) preserve_merges=t test -z $interactive_rebase interactive_rebase=implied ;; @@ -267,21 +265,19 @@ do --no-fork-point) fork_point= ;; - -m) + --merge) do_merge=t ;; - -X) - shift - strategy_opts=$strategy_opts $(git rev-parse --sq-quote --$1) + --strategy-option=*) + strategy_opts=$strategy_opts $(git rev-parse --sq-quote --${1#--strategy-option=}) do_merge=t test -z $strategy strategy=recursive ;; - -s) - shift - strategy=$1 + --strategy=*) + strategy=${1#--strategy=} do_merge=t ;; - -n) + --no-stat) diffstat= ;; --stat) @@ -290,21 +286,20 @@ do --autostash) autostash=true ;; - -v) + --verbose) verbose=t diffstat=t GIT_QUIET= ;; - -q) + --quiet) GIT_QUIET=t git_am_opt=$git_am_opt -q verbose= diffstat= ;; - --whitespace) - shift - git_am_opt=$git_am_opt --whitespace=$1 - case $1 in + --whitespace=*) + git_am_opt=$git_am_opt --whitespace=${1#--whitespace=} + case ${1#--whitespace=} in fix|strip) force_rebase=t ;; @@ -317,14 +312,13 @@ do git_am_opt=$git_am_opt $1 force_rebase=t ;; - -C) - shift - git_am_opt=$git_am_opt -C$1 + -C*) + git_am_opt=$git_am_opt $1 ;; --root) rebase_root=t ;; - -f|--no-ff) + --force-rebase|--no-ff) force_rebase=t ;; --rerere-autoupdate|--no-rerere-autoupdate) -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/9] am: parse options in stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org There is no functional change. The reason for this change is to be able to add a new option taking an optional argument. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-am.sh | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/git-am.sh b/git-am.sh index a3b6f98..020abf6 100755 --- a/git-am.sh +++ b/git-am.sh @@ -4,7 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC=\ git am [options] [(mbox|Maildir)...] git am [options] (--continue | --skip | --abort) @@ -414,14 +414,14 @@ it will be removed. Please do not use it anymore. abort=t ;; --rebasing) rebasing=t threeway=t ;; - --resolvemsg) - shift; resolvemsg=$1 ;; - --whitespace|--directory|--exclude|--include) - git_apply_opt=$git_apply_opt $(sq $1=$2); shift ;; - -C|-p) - git_apply_opt=$git_apply_opt $(sq $1$2); shift ;; - --patch-format) - shift ; patch_format=$1 ;; + --resolvemsg=*) + resolvemsg=${1#--resolvemsg=} ;; + --whitespace=*|--directory=*|--exclude=*|--include=*) + git_apply_opt=$git_apply_opt $(sq $1) ;; + -C*|-p*) + git_apply_opt=$git_apply_opt $(sq $1) ;; + --patch-format=*) + patch_format=${1#--patch-format=} ;; --reject|--ignore-whitespace|--ignore-space-change) git_apply_opt=$git_apply_opt $1 ;; --committer-date-is-author-date) -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 2/9] git-sh-setup.sh: add variable to use the stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org If the variable $OPTIONS_STUCKLONG is not empty, then rev-parse option parsing is done in --stuck-long mode. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- contrib/git-resurrect.sh | 1 + git-am.sh| 1 + git-instaweb.sh | 1 + git-quiltimport.sh | 1 + git-rebase.sh| 1 + git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ 7 files changed, 8 insertions(+) diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh index a4ed4c3..d7e97bb 100755 --- a/contrib/git-resurrect.sh +++ b/contrib/git-resurrect.sh @@ -10,6 +10,7 @@ is rather slow but allows you to resurrect other people's topic branches. OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git resurrect $USAGE -- diff --git a/git-am.sh b/git-am.sh index bbea430..a3b6f98 100755 --- a/git-am.sh +++ b/git-am.sh @@ -4,6 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git am [options] [(mbox|Maildir)...] git am [options] (--continue | --skip | --abort) diff --git a/git-instaweb.sh b/git-instaweb.sh index e93a238..4aa3eb8 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -5,6 +5,7 @@ PERL='@@PERL@@' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git instaweb [options] (--start | --stop | --restart) -- diff --git a/git-quiltimport.sh b/git-quiltimport.sh index 8e17525..167d79f 100755 --- a/git-quiltimport.sh +++ b/git-quiltimport.sh @@ -1,5 +1,6 @@ #!/bin/sh OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git quiltimport [options] -- diff --git a/git-rebase.sh b/git-rebase.sh index 8a3efa2..c1f98ae 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -5,6 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git rebase [-i] [options] [--exec cmd] [--onto newbase] [upstream] [branch] git rebase [-i] [options] [--exec cmd] [--onto newbase] --root [branch] diff --git a/git-request-pull.sh b/git-request-pull.sh index fe21d5d..cf4f150 100755 --- a/git-request-pull.sh +++ b/git-request-pull.sh @@ -9,6 +9,7 @@ LONG_USAGE='Summarizes the changes between two commits to the standard output, and includes the given URL in the generated summary.' SUBDIRECTORY_OK='Yes' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC='git request-pull [options] start url [end] -- pshow patch text as well diff --git a/git-sh-setup.sh b/git-sh-setup.sh index fffa3c7..5f28b32 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -72,6 +72,8 @@ if test -n $OPTIONS_SPEC; then parseopt_extra= [ -n $OPTIONS_KEEPDASHDASH ] parseopt_extra=--keep-dashdash + [ -n $OPTIONS_STUCKLONG ] + parseopt_extra=$parseopt_extra --stuck-long eval $( echo $OPTIONS_SPEC | -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 6/9] rebase: don't try to match -M option
From: Nicolas Vigier bo...@mars-attacks.org The -M option does not exist in OPTIONS_SPEC, so there is no use to try to find it. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-rebase.sh b/git-rebase.sh index d1835ba..3b55211 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -267,7 +267,7 @@ do --no-fork-point) fork_point= ;; - -M|-m) + -m) do_merge=t ;; -X) -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/9] add --gpg-sign to rebase and pull
This series was posted to the list some time back. This is a re-send of Nicolas Vigier's work with an additional patch that adds --gpg-sign to pull as well, as well as the fixes that Junio suggested in review. Since the parsed option value for --gpg-sign=value is used not only as an argument to other commands, but also as output to the user, I chose to abuse git rev-parse --sq-quote slightly to quote only the argument, which I feel is more aesthetically pleasing than quoting the entire option, and perhaps less confusing for the novice shell user. Both options are equally functional. Other than that, this is a simple reroll addressing Junio's review comments. I've been using it on my laptop for some time, and it works fine for me, although further comments are certainly welcome. Nicolas Vigier (8): cherry-pick, revert: add the --gpg-sign option git-sh-setup.sh: add variable to use the stuck-long mode am: parse options in stuck-long mode am: add the --gpg-sign option rebase: remove useless arguments check rebase: don't try to match -M option rebase: parse options in stuck-long mode rebase: add the --gpg-sign option brian m. carlson (1): pull: add the --gpg-sign option. Documentation/git-am.txt | 6 +++- Documentation/git-cherry-pick.txt | 7 - Documentation/git-rebase.txt | 4 +++ Documentation/git-revert.txt | 6 +++- builtin/revert.c | 2 ++ contrib/git-resurrect.sh | 1 + git-am.sh | 26 ++-- git-instaweb.sh | 1 + git-pull.sh | 13 +++- git-quiltimport.sh| 1 + git-rebase--am.sh | 8 +++-- git-rebase--interactive.sh| 32 +++ git-rebase--merge.sh | 2 +- git-rebase.sh | 65 ++- git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ sequencer.c | 11 +++ sequencer.h | 2 ++ 18 files changed, 132 insertions(+), 58 deletions(-) -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/9] cherry-pick, revert: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-cherry-pick.txt | 7 ++- Documentation/git-revert.txt | 6 +- builtin/revert.c | 2 ++ sequencer.c | 11 +++ sequencer.h | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index c205d23..f1e6b2f 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS [verse] -'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... +'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] + [-S[keyid]] commit... 'git cherry-pick' --continue 'git cherry-pick' --quit 'git cherry-pick' --abort @@ -100,6 +101,10 @@ effect to your index in a row. --signoff:: Add Signed-off-by line at the end of the commit message. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + --ff:: If the current HEAD is the same as the parent of the cherry-pick'ed commit, then a fast forward to this commit will diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index 2de67a5..9eb83f0 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -8,7 +8,7 @@ git-revert - Revert some existing commits SYNOPSIS [verse] -'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] commit... +'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[keyid]] commit... 'git revert' --continue 'git revert' --quit 'git revert' --abort @@ -80,6 +80,10 @@ more details. This is useful when reverting more than one commits' effect to your index in a row. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + -s:: --signoff:: Add Signed-off-by line at the end of the commit message. diff --git a/builtin/revert.c b/builtin/revert.c index 87659c9..065d88d 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_STRING(0, strategy, opts-strategy, N_(strategy), N_(merge strategy)), OPT_CALLBACK('X', strategy-option, opts, N_(option), N_(option for merge strategy), option_parse_x), + { OPTION_STRING, 'S', gpg-sign, opts-gpg_sign, N_(key id), + N_(GPG sign commit), PARSE_OPT_OPTARG, NULL, (intptr_t) }, OPT_END(), OPT_END(), OPT_END(), diff --git a/sequencer.c b/sequencer.c index 90cac7b..bde5f04 100644 --- a/sequencer.c +++ b/sequencer.c @@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, { struct argv_array array; int rc; + char *gpg_sign; argv_array_init(array); argv_array_push(array, commit); argv_array_push(array, -n); + if (opts-gpg_sign) { + gpg_sign = xmalloc(3 + strlen(opts-gpg_sign)); + sprintf(gpg_sign, -S%s, opts-gpg_sign); + argv_array_push(array, gpg_sign); + free(gpg_sign); + } if (opts-signoff) argv_array_push(array, -s); if (!opts-edit) { @@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data) opts-mainline = git_config_int(key, value); else if (!strcmp(key, options.strategy)) git_config_string(opts-strategy, key, value); + else if (!strcmp(key, options.gpg-sign)) + git_config_string(opts-gpg_sign, key, value); else if (!strcmp(key, options.strategy-option)) { ALLOC_GROW(opts-xopts, opts-xopts_nr + 1, opts-xopts_alloc); opts-xopts[opts-xopts_nr++] = xstrdup(value); @@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts) } if (opts-strategy) git_config_set_in_file(opts_file, options.strategy, opts-strategy); + if (opts-gpg_sign) + git_config_set_in_file(opts_file, options.gpg-sign, opts-gpg_sign); if (opts-xopts) { int i; for (i = 0; i opts-xopts_nr; i++) diff --git a/sequencer.h b/sequencer.h index 1fc22dc..db43e9c 100644 --- a/sequencer.h +++ b/sequencer.h @@ -37,6 +37,8 @@ struct replay_opts { int mainline; + const char *gpg_sign; + /* Merge strategy */ const char *strategy; const char **xopts; -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo
[PATCH v3 9/9] pull: add the --gpg-sign option.
git merge already allows us to sign commits, and git rebase has recently learned how to do so as well. Teach git pull to parse the -S/--gpg-sign option and pass this along to merge or rebase, as appropriate. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-pull.sh | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/git-pull.sh b/git-pull.sh index 0a5aa2c..3b2ea9e 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -138,6 +138,15 @@ do --no-verify-signatures) verify_signatures=--no-verify-signatures ;; + --gpg-sign|-S) + gpg_sign_args=-S + ;; + --gpg-sign=*) + gpg_sign_args=$(git rev-parse --sq-quote -S${1#--gpg-sign=}) + ;; + -S*) + gpg_sign_args=-S${1#-S} + ;; --d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run) dry_run=--dry-run ;; @@ -305,11 +314,13 @@ merge_name=$(git fmt-merge-msg $log_arg $GIT_DIR/FETCH_HEAD) || exit case $rebase in true) eval=git-rebase $diffstat $strategy_args $merge_args $rebase_args $verbosity + eval=$eval $gpg_sign_args eval=$eval --onto $merge_head ${oldremoteref:-$merge_head} ;; *) eval=git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only - eval=$eval $log_arg $strategy_args $merge_args $verbosity $progress + eval=$eval $log_arg $strategy_args $merge_args $verbosity $progress + eval=$eval $gpg_sign_args eval=$eval \\$merge_name\ HEAD $merge_head ;; esac -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 8/9] rebase: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-rebase.txt | 4 git-rebase--am.sh| 8 +--- git-rebase--interactive.sh | 32 git-rebase--merge.sh | 2 +- git-rebase.sh| 14 ++ 5 files changed, 44 insertions(+), 16 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 2889be6..2a93c64 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -281,6 +281,10 @@ which makes little sense. specified, `-s recursive`. Note the reversal of 'ours' and 'theirs' as noted above for the `-m` option. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + -q:: --quiet:: Be quiet. Implies --no-stat. diff --git a/git-rebase--am.sh b/git-rebase--am.sh index a4f683a..df46f4c 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -6,7 +6,8 @@ case $action in continue) - git am --resolved --resolvemsg=$resolvemsg + git am --resolved --resolvemsg=$resolvemsg \ + ${gpg_sign_opt:+$gpg_sign_opt} move_to_original_branch return ;; @@ -26,7 +27,7 @@ then # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick # makes this easy - git cherry-pick --allow-empty $revisions + git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} --allow-empty $revisions ret=$? else rm -f $GIT_DIR/rebased-patches @@ -60,7 +61,8 @@ else return $? fi - git am $git_am_opt --rebasing --resolvemsg=$resolvemsg $GIT_DIR/rebased-patches + git am $git_am_opt --rebasing --resolvemsg=$resolvemsg \ + ${gpg_sign_opt:+$gpg_sign_opt} $GIT_DIR/rebased-patches ret=$? rm -f $GIT_DIR/rebased-patches diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 43c19e0..73d32dd 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -181,7 +181,7 @@ exit_with_patch () { git rev-parse --verify HEAD $amend warn You can amend the commit now, with warn - warn git commit --amend + warn git commit --amend $gpg_sign_opt warn warn Once you are satisfied with your changes, run warn @@ -248,7 +248,8 @@ pick_one () { test -d $rewritten pick_one_preserving_merges $@ return - output eval git cherry-pick $strategy_args $empty_args $ff $@ + output eval git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} \ + $strategy_args $empty_args $ff $@ } pick_one_preserving_merges () { @@ -359,7 +360,8 @@ pick_one_preserving_merges () { echo $sha1 $(git rev-parse HEAD^0) $rewritten_list ;; *) - output eval git cherry-pick $strategy_args $@ || + output eval git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} \ + $strategy_args $@ || die_with_patch $sha1 Could not pick $sha1 ;; esac @@ -470,7 +472,8 @@ do_pick () { --no-post-rewrite -n -q -C $1 pick_one -n $1 git commit --allow-empty --allow-empty-message \ - --amend --no-post-rewrite -n -q -C $1 || + --amend --no-post-rewrite -n -q -C $1 \ + ${gpg_sign_opt:+$gpg_sign_opt} || die_with_patch $1 Could not apply $1... $2 else pick_one $1 || @@ -497,7 +500,7 @@ do_next () { mark_action_done do_pick $sha1 $rest - git commit --amend --no-post-rewrite || { + git commit --amend --no-post-rewrite ${gpg_sign_opt:+$gpg_sign_opt} || { warn Could not amend commit after successfully picking $sha1... $rest warn This is most likely due to an empty commit message, or the pre-commit hook warn failed. If the pre-commit hook failed, you may need to resolve the issue before @@ -542,19 +545,22 @@ do_next () { squash|s|fixup|f) # This is an intermediate commit; its message will only be # used in case of trouble. So use the long version: - do_with_author output git commit --amend --no-verify -F $squash_msg || + do_with_author output git commit --amend --no-verify -F $squash_msg \ + ${gpg_sign_opt:+$gpg_sign_opt
[PATCH v3 4/9] am: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-am.txt | 6 +- git-am.sh| 9 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 54d8461..17924d0 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -14,7 +14,7 @@ SYNOPSIS [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=option] [-Cn] [-pn] [--directory=dir] [--exclude=path] [--include=path] [--reject] [-q | --quiet] -[--[no-]scissors] +[--[no-]scissors] [-S[keyid]] [(mbox | Maildir)...] 'git am' (--continue | --skip | --abort) @@ -119,6 +119,10 @@ default. You can use `--no-utf8` to override this. Skip the current patch. This is only meaningful when restarting an aborted patch. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + --continue:: -r:: --resolved:: diff --git a/git-am.sh b/git-am.sh index 020abf6..78517f2 100755 --- a/git-am.sh +++ b/git-am.sh @@ -38,6 +38,7 @@ abort restore the original branch and abort the patching operation. committer-date-is-author-datelie about committer date ignore-date use current timestamp for author date rerere-autoupdate update the index with reused conflict resolution if possible +S,gpg-sign? GPG-sign commits rebasing* (internal use for git-rebase) . git-sh-setup @@ -375,6 +376,7 @@ git_apply_opt= committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= +gpg_sign_opt= if test $(git config --bool --get am.keepcr) = true then @@ -436,6 +438,10 @@ it will be removed. Please do not use it anymore. keepcr=t ;; --no-keep-cr) keepcr=f ;; + --gpg-sign) + gpg_sign_opt=-S ;; + --gpg-sign=*) + gpg_sign_opt=-S${1#--gpg-sign=} ;; --) shift; break ;; *) @@ -900,7 +906,8 @@ did you forget to use 'git add'? GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE export GIT_COMMITTER_DATE fi - git commit-tree $tree ${parent:+-p} $parent $dotest/final-commit + git commit-tree ${parent:+-p} $parent ${gpg_sign_opt:+$gpg_sign_opt} $tree \ + $dotest/final-commit ) git update-ref -m $GIT_REFLOG_ACTION: $FIRSTLINE HEAD $commit $parent || stop_here $this -- 1.9.rc1.1006.g13f506b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Determining update/merge/current state of a workspace
On Sun, Feb 02, 2014 at 03:04:59PM -0800, David Aguilar wrote: I think you're looking for git merge-base. If you do `git merge-base HEAD origin/master` and its result is equal to `git rev-parse HEAD` then you know that master is an ancestor of origin/master and can be trivially fast-forwarded to origin/master. In newer versions of git (1.8.0+), you can use git merge-base --is-ancestor for this instead. The commit message for 5907cda implies that it is more efficient than the old way. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v3 8/9] rebase: add the --gpg-sign option
On Mon, Feb 03, 2014 at 01:42:06PM -0800, Junio C Hamano wrote: + --gpg-sign) + gpg_sign_opt=-S + ;; + --gpg-sign=*) + # Try to quote only the argument, as this will appear in human-readable + # output as well as being passed to commands. + gpg_sign_opt=-S$(git rev-parse --sq-quote ${1#--gpg-sign=} | + sed 's/^ //') Isn't an invocation of sed excessive? gpg_sign_opt=$(git rev-parse --sq-quote ${1#--gpg-sign=}) gpg_sign_opt=-S${gpg_sign_opt# } if you really need to strip the leading SP, which I do not think is a necessary thing to do. It is sufficient to remove the SP before the variable substitution in the human-readable messages, e.g. I'm not sure that command line parsing of -S 'foo x...@example.tld' will work exactly as expected due to the fact that -S doesn't always take an argument. Your suggestion to use # seems fine, though. I'm a little embarrassed to admit that in my fifteen years of Unix experience, I've never learned the variable modifiers for shell, so it didn't occur to me to use them in this case. Guess it's time to learn them now. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: git best strategy for two version development
On Sat, Feb 08, 2014 at 02:06:41AM +, Carlos Pereira wrote: Hello, I am a git and CVS newbie, I bought and red most of the excellent Pro Git book by Scott Chacon, but I still have a doubt. I have a package that I distribute in two versions differing only in one library: version_A uses this library, version_B uses my own code to replace it. For strategic reasons I want to keep it this way for the time being. Both versions have the same documentation, the same data files, and 99% of the source code is the same (a few makefile changes, two additional files in version_B and some minor changes: a diff -r has only 170 lines). The question is what is the best strategy to manage a situation like this with git? Shall I maintain two different repositories? I don't think so... Apparently the best solution would be to maintain two long term branches, say mater_A and master_B, and merge all later developments in both branches, keeping the initial difference... Specifically: 1) do some new work in branch master_A, commit, etc. 2) checkout master_B and merge the new work in master_B, without merging the initial diff between the two versions. What is the better way to do that? That's pretty much the way to do it. If you check in master-A, then create the master-B branch off of that, copying in the code from B and checking it in, then when you merge from master-A to master-B, git will basically do the right thing. Changes you make on master-A that are specific to that version will probably conflict, but they should be easy to fix up. I basically do this for a consulting project for a client: there's generic code in master, and a special branch for the client. Since most changes don't touch the modified code, conflicts are infrequent, and I can fix them up when they occur. I also do it for my dotfiles, which vary slightly between home and work. You could also make the changes to master-B as a set of commits on top of master-A, and always rebase master-B on master-A, but this isn't a good solution if other people are going to be using your code. It has the benefits of keeping the history free of frequent merges, which may or may not be important to you; it doesn't really bother me very much. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: Bug tracker (again)
On Sat, Feb 08, 2014 at 02:26:57PM +0700, Duy Nguyen wrote: So I wonder if we use debian bug tracker for git upstream. I haven't used debian tracker much (or debian for that matter). It's probably best just ask instead of searching and guessing. I suppose if debian people (mostly debian git maintainer?) are not opposed to us using their tracker for upstream bugs, then it's just a matter of associating a mail thread with a bug number for tracking. That could be probably be done via email, then reply all to the thread in question with a bug email address. After that all email discussions are also tracked via this bug email. Anybody can help track bugs. Say if 3 weekdays are over and nobody said a thing about something that looks a lot like bug, then it should be tracked (problems that can be quickly fixed do not need tracking). Hmm? All interaction with the Debian BTS (except for viewing bugs) is done over email. That's what I like about it. It will automatically insert an appropriate piece in the subject line (Bug#1393:) and anyone can mail the control bot to manipulate a bug. It also has the concept of usertags, so you can create your own set of tags with user git@vger.kernel.org (or your personal address, if you desire), and then sort and display bugs appropriately. Junio seemed lukewarm on the idea of using a bug tracker; however, I think debbugs (either the Debian BTS or a separate instance) is probably the best-suited to an email-based workflow of all the systems I've used. Of course, it's up to the regulars (and probably ultimately Junio) whether this is something that Git as a project would benefit from. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH v4 0/9] add --gpg-sign to rebase and pull
This series was posted to the list some time back. This is a re-send of Nicolas Vigier's work with an additional patch that adds --gpg-sign to pull as well, as well as the fixes that Junio suggested in review for v3. There is also one additional merge call that was not previously given a signature option that is now provided one. I believe this was an oversight, so I fixed it. The major change in this version is fixed quoting for the arguments. All the quoting should now be correct. I reverted the change that placed quoting around only the argument to -S, as this was too difficult to get consistently right and nobody objected to '-S1F52F68B!' as being too ugly to display to the user. Nicolas Vigier (8): cherry-pick, revert: add the --gpg-sign option git-sh-setup.sh: add variable to use the stuck-long mode am: parse options in stuck-long mode am: add the --gpg-sign option rebase: remove useless arguments check rebase: don't try to match -M option rebase: parse options in stuck-long mode rebase: add the --gpg-sign option brian m. carlson (1): pull: add the --gpg-sign option. Documentation/git-am.txt | 6 +++- Documentation/git-cherry-pick.txt | 7 - Documentation/git-rebase.txt | 4 +++ Documentation/git-revert.txt | 6 +++- builtin/revert.c | 2 ++ contrib/git-resurrect.sh | 1 + git-am.sh | 26 ++-- git-instaweb.sh | 1 + git-pull.sh | 13 +++- git-quiltimport.sh| 1 + git-rebase--am.sh | 8 +++-- git-rebase--interactive.sh| 39 git-rebase--merge.sh | 2 +- git-rebase.sh | 62 +-- git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ sequencer.c | 11 +++ sequencer.h | 2 ++ 18 files changed, 135 insertions(+), 59 deletions(-) -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 3/9] am: parse options in stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org There is no functional change. The reason for this change is to be able to add a new option taking an optional argument. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-am.sh | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/git-am.sh b/git-am.sh index a3b6f98..020abf6 100755 --- a/git-am.sh +++ b/git-am.sh @@ -4,7 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC=\ git am [options] [(mbox|Maildir)...] git am [options] (--continue | --skip | --abort) @@ -414,14 +414,14 @@ it will be removed. Please do not use it anymore. abort=t ;; --rebasing) rebasing=t threeway=t ;; - --resolvemsg) - shift; resolvemsg=$1 ;; - --whitespace|--directory|--exclude|--include) - git_apply_opt=$git_apply_opt $(sq $1=$2); shift ;; - -C|-p) - git_apply_opt=$git_apply_opt $(sq $1$2); shift ;; - --patch-format) - shift ; patch_format=$1 ;; + --resolvemsg=*) + resolvemsg=${1#--resolvemsg=} ;; + --whitespace=*|--directory=*|--exclude=*|--include=*) + git_apply_opt=$git_apply_opt $(sq $1) ;; + -C*|-p*) + git_apply_opt=$git_apply_opt $(sq $1) ;; + --patch-format=*) + patch_format=${1#--patch-format=} ;; --reject|--ignore-whitespace|--ignore-space-change) git_apply_opt=$git_apply_opt $1 ;; --committer-date-is-author-date) -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 6/9] rebase: don't try to match -M option
From: Nicolas Vigier bo...@mars-attacks.org The -M option does not exist in OPTIONS_SPEC, so there is no use to try to find it. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-rebase.sh b/git-rebase.sh index d1835ba..3b55211 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -267,7 +267,7 @@ do --no-fork-point) fork_point= ;; - -M|-m) + -m) do_merge=t ;; -X) -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 2/9] git-sh-setup.sh: add variable to use the stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org If the variable $OPTIONS_STUCKLONG is not empty, then rev-parse option parsing is done in --stuck-long mode. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- contrib/git-resurrect.sh | 1 + git-am.sh| 1 + git-instaweb.sh | 1 + git-quiltimport.sh | 1 + git-rebase.sh| 1 + git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ 7 files changed, 8 insertions(+) diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh index a4ed4c3..d7e97bb 100755 --- a/contrib/git-resurrect.sh +++ b/contrib/git-resurrect.sh @@ -10,6 +10,7 @@ is rather slow but allows you to resurrect other people's topic branches. OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git resurrect $USAGE -- diff --git a/git-am.sh b/git-am.sh index bbea430..a3b6f98 100755 --- a/git-am.sh +++ b/git-am.sh @@ -4,6 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git am [options] [(mbox|Maildir)...] git am [options] (--continue | --skip | --abort) diff --git a/git-instaweb.sh b/git-instaweb.sh index e93a238..4aa3eb8 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -5,6 +5,7 @@ PERL='@@PERL@@' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git instaweb [options] (--start | --stop | --restart) -- diff --git a/git-quiltimport.sh b/git-quiltimport.sh index 8e17525..167d79f 100755 --- a/git-quiltimport.sh +++ b/git-quiltimport.sh @@ -1,5 +1,6 @@ #!/bin/sh OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git quiltimport [options] -- diff --git a/git-rebase.sh b/git-rebase.sh index 8a3efa2..c1f98ae 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -5,6 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git rebase [-i] [options] [--exec cmd] [--onto newbase] [upstream] [branch] git rebase [-i] [options] [--exec cmd] [--onto newbase] --root [branch] diff --git a/git-request-pull.sh b/git-request-pull.sh index fe21d5d..cf4f150 100755 --- a/git-request-pull.sh +++ b/git-request-pull.sh @@ -9,6 +9,7 @@ LONG_USAGE='Summarizes the changes between two commits to the standard output, and includes the given URL in the generated summary.' SUBDIRECTORY_OK='Yes' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC='git request-pull [options] start url [end] -- pshow patch text as well diff --git a/git-sh-setup.sh b/git-sh-setup.sh index fffa3c7..5f28b32 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -72,6 +72,8 @@ if test -n $OPTIONS_SPEC; then parseopt_extra= [ -n $OPTIONS_KEEPDASHDASH ] parseopt_extra=--keep-dashdash + [ -n $OPTIONS_STUCKLONG ] + parseopt_extra=$parseopt_extra --stuck-long eval $( echo $OPTIONS_SPEC | -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 4/9] am: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-am.txt | 6 +- git-am.sh| 9 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 54d8461..17924d0 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -14,7 +14,7 @@ SYNOPSIS [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=option] [-Cn] [-pn] [--directory=dir] [--exclude=path] [--include=path] [--reject] [-q | --quiet] -[--[no-]scissors] +[--[no-]scissors] [-S[keyid]] [(mbox | Maildir)...] 'git am' (--continue | --skip | --abort) @@ -119,6 +119,10 @@ default. You can use `--no-utf8` to override this. Skip the current patch. This is only meaningful when restarting an aborted patch. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + --continue:: -r:: --resolved:: diff --git a/git-am.sh b/git-am.sh index 020abf6..78517f2 100755 --- a/git-am.sh +++ b/git-am.sh @@ -38,6 +38,7 @@ abort restore the original branch and abort the patching operation. committer-date-is-author-datelie about committer date ignore-date use current timestamp for author date rerere-autoupdate update the index with reused conflict resolution if possible +S,gpg-sign? GPG-sign commits rebasing* (internal use for git-rebase) . git-sh-setup @@ -375,6 +376,7 @@ git_apply_opt= committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= +gpg_sign_opt= if test $(git config --bool --get am.keepcr) = true then @@ -436,6 +438,10 @@ it will be removed. Please do not use it anymore. keepcr=t ;; --no-keep-cr) keepcr=f ;; + --gpg-sign) + gpg_sign_opt=-S ;; + --gpg-sign=*) + gpg_sign_opt=-S${1#--gpg-sign=} ;; --) shift; break ;; *) @@ -900,7 +906,8 @@ did you forget to use 'git add'? GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE export GIT_COMMITTER_DATE fi - git commit-tree $tree ${parent:+-p} $parent $dotest/final-commit + git commit-tree ${parent:+-p} $parent ${gpg_sign_opt:+$gpg_sign_opt} $tree \ + $dotest/final-commit ) git update-ref -m $GIT_REFLOG_ACTION: $FIRSTLINE HEAD $commit $parent || stop_here $this -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 9/9] pull: add the --gpg-sign option.
git merge already allows us to sign commits, and git rebase has recently learned how to do so as well. Teach git pull to parse the -S/--gpg-sign option and pass this along to merge or rebase, as appropriate. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-pull.sh | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/git-pull.sh b/git-pull.sh index 0a5aa2c..6986e0f 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -138,6 +138,15 @@ do --no-verify-signatures) verify_signatures=--no-verify-signatures ;; + --gpg-sign|-S) + gpg_sign_args=-S + ;; + --gpg-sign=*) + gpg_sign_args=$(git rev-parse --sq-quote -S${1#--gpg-sign=}) + ;; + -S*) + gpg_sign_args=$(git rev-parse --sq-quote $1) + ;; --d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run) dry_run=--dry-run ;; @@ -305,11 +314,13 @@ merge_name=$(git fmt-merge-msg $log_arg $GIT_DIR/FETCH_HEAD) || exit case $rebase in true) eval=git-rebase $diffstat $strategy_args $merge_args $rebase_args $verbosity + eval=$eval $gpg_sign_args eval=$eval --onto $merge_head ${oldremoteref:-$merge_head} ;; *) eval=git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only - eval=$eval $log_arg $strategy_args $merge_args $verbosity $progress + eval=$eval $log_arg $strategy_args $merge_args $verbosity $progress + eval=$eval $gpg_sign_args eval=$eval \\$merge_name\ HEAD $merge_head ;; esac -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 5/9] rebase: remove useless arguments check
From: Nicolas Vigier bo...@mars-attacks.org Remove a check on the number of arguments for --onto and -x options. It is not possible for $# to be = 2 at this point : - if --onto or -x has an argument, git rev-parse --parseopt will provide something like this : set -- --onto 'x' -- when parsing the --onto option, $# will be 3 or more if there are other options. - if --onto or -x doesn't have an argument, git rev-parse --parseopt will exit with an error and display usage information. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index c1f98ae..d1835ba 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -238,12 +238,10 @@ do action=${1##--} ;; --onto) - test 2 -le $# || usage onto=$2 shift ;; -x) - test 2 -le $# || usage cmd=${cmd}exec $2${LF} shift ;; -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/9] cherry-pick, revert: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-cherry-pick.txt | 7 ++- Documentation/git-revert.txt | 6 +- builtin/revert.c | 2 ++ sequencer.c | 11 +++ sequencer.h | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index c205d23..f1e6b2f 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS [verse] -'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... +'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] + [-S[keyid]] commit... 'git cherry-pick' --continue 'git cherry-pick' --quit 'git cherry-pick' --abort @@ -100,6 +101,10 @@ effect to your index in a row. --signoff:: Add Signed-off-by line at the end of the commit message. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + --ff:: If the current HEAD is the same as the parent of the cherry-pick'ed commit, then a fast forward to this commit will diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index 2de67a5..9eb83f0 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -8,7 +8,7 @@ git-revert - Revert some existing commits SYNOPSIS [verse] -'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] commit... +'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[keyid]] commit... 'git revert' --continue 'git revert' --quit 'git revert' --abort @@ -80,6 +80,10 @@ more details. This is useful when reverting more than one commits' effect to your index in a row. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + -s:: --signoff:: Add Signed-off-by line at the end of the commit message. diff --git a/builtin/revert.c b/builtin/revert.c index 87659c9..065d88d 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_STRING(0, strategy, opts-strategy, N_(strategy), N_(merge strategy)), OPT_CALLBACK('X', strategy-option, opts, N_(option), N_(option for merge strategy), option_parse_x), + { OPTION_STRING, 'S', gpg-sign, opts-gpg_sign, N_(key id), + N_(GPG sign commit), PARSE_OPT_OPTARG, NULL, (intptr_t) }, OPT_END(), OPT_END(), OPT_END(), diff --git a/sequencer.c b/sequencer.c index 90cac7b..bde5f04 100644 --- a/sequencer.c +++ b/sequencer.c @@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, { struct argv_array array; int rc; + char *gpg_sign; argv_array_init(array); argv_array_push(array, commit); argv_array_push(array, -n); + if (opts-gpg_sign) { + gpg_sign = xmalloc(3 + strlen(opts-gpg_sign)); + sprintf(gpg_sign, -S%s, opts-gpg_sign); + argv_array_push(array, gpg_sign); + free(gpg_sign); + } if (opts-signoff) argv_array_push(array, -s); if (!opts-edit) { @@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data) opts-mainline = git_config_int(key, value); else if (!strcmp(key, options.strategy)) git_config_string(opts-strategy, key, value); + else if (!strcmp(key, options.gpg-sign)) + git_config_string(opts-gpg_sign, key, value); else if (!strcmp(key, options.strategy-option)) { ALLOC_GROW(opts-xopts, opts-xopts_nr + 1, opts-xopts_alloc); opts-xopts[opts-xopts_nr++] = xstrdup(value); @@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts) } if (opts-strategy) git_config_set_in_file(opts_file, options.strategy, opts-strategy); + if (opts-gpg_sign) + git_config_set_in_file(opts_file, options.gpg-sign, opts-gpg_sign); if (opts-xopts) { int i; for (i = 0; i opts-xopts_nr; i++) diff --git a/sequencer.h b/sequencer.h index 1fc22dc..db43e9c 100644 --- a/sequencer.h +++ b/sequencer.h @@ -37,6 +37,8 @@ struct replay_opts { int mainline; + const char *gpg_sign; + /* Merge strategy */ const char *strategy; const char **xopts; -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo
[PATCH v4 8/9] rebase: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-rebase.txt | 4 git-rebase--am.sh| 8 +--- git-rebase--interactive.sh | 39 ++- git-rebase--merge.sh | 2 +- git-rebase.sh| 11 +++ 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 2889be6..2a93c64 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -281,6 +281,10 @@ which makes little sense. specified, `-s recursive`. Note the reversal of 'ours' and 'theirs' as noted above for the `-m` option. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + -q:: --quiet:: Be quiet. Implies --no-stat. diff --git a/git-rebase--am.sh b/git-rebase--am.sh index a4f683a..df46f4c 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -6,7 +6,8 @@ case $action in continue) - git am --resolved --resolvemsg=$resolvemsg + git am --resolved --resolvemsg=$resolvemsg \ + ${gpg_sign_opt:+$gpg_sign_opt} move_to_original_branch return ;; @@ -26,7 +27,7 @@ then # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick # makes this easy - git cherry-pick --allow-empty $revisions + git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} --allow-empty $revisions ret=$? else rm -f $GIT_DIR/rebased-patches @@ -60,7 +61,8 @@ else return $? fi - git am $git_am_opt --rebasing --resolvemsg=$resolvemsg $GIT_DIR/rebased-patches + git am $git_am_opt --rebasing --resolvemsg=$resolvemsg \ + ${gpg_sign_opt:+$gpg_sign_opt} $GIT_DIR/rebased-patches ret=$? rm -f $GIT_DIR/rebased-patches diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 43c19e0..a1adae8 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -179,9 +179,10 @@ exit_with_patch () { echo $1 $state_dir/stopped-sha make_patch $1 git rev-parse --verify HEAD $amend + gpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote $gpg_sign_opt)} warn You can amend the commit now, with warn - warn git commit --amend + warn git commit --amend $gpg_sign_opt_quoted warn warn Once you are satisfied with your changes, run warn @@ -248,7 +249,9 @@ pick_one () { test -d $rewritten pick_one_preserving_merges $@ return - output eval git cherry-pick $strategy_args $empty_args $ff $@ + output eval git cherry-pick \ + ${gpg_sign_opt:+$(git rev-parse --sq-quote $gpg_sign_opt)} \ + $strategy_args $empty_args $ff $@ } pick_one_preserving_merges () { @@ -351,7 +354,8 @@ pick_one_preserving_merges () { new_parents=${new_parents# $first_parent} merge_args=--no-log --no-ff if ! do_with_author output eval \ - 'git merge $merge_args $strategy_args -m $msg_content $new_parents' + 'git merge ${gpg_sign_opt:+$gpg_sign_opt} \ + $merge_args $strategy_args -m $msg_content $new_parents' then printf %s\n $msg_content $GIT_DIR/MERGE_MSG die_with_patch $sha1 Error redoing merge $sha1 @@ -359,7 +363,9 @@ pick_one_preserving_merges () { echo $sha1 $(git rev-parse HEAD^0) $rewritten_list ;; *) - output eval git cherry-pick $strategy_args $@ || + output eval git cherry-pick \ + ${gpg_sign_opt:+$(git rev-parse --sq-quote $gpg_sign_opt)} \ + $strategy_args $@ || die_with_patch $sha1 Could not pick $sha1 ;; esac @@ -470,7 +476,8 @@ do_pick () { --no-post-rewrite -n -q -C $1 pick_one -n $1 git commit --allow-empty --allow-empty-message \ - --amend --no-post-rewrite -n -q -C $1 || + --amend --no-post-rewrite -n -q -C $1 \ + ${gpg_sign_opt:+$gpg_sign_opt} || die_with_patch $1 Could not apply $1... $2 else pick_one $1 || @@ -497,7 +504,7 @@ do_next () { mark_action_done do_pick $sha1 $rest - git commit --amend
[PATCH v4 7/9] rebase: parse options in stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org There is no functionnal change. The reason for this change is to be able to add a new option taking an optional argument. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 50 ++ 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index 3b55211..842d7d4 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -5,7 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC=\ git rebase [-i] [options] [--exec cmd] [--onto newbase] [upstream] [branch] git rebase [-i] [options] [--exec cmd] [--onto newbase] --root [branch] @@ -237,21 +237,19 @@ do test $total_argc -eq 2 || usage action=${1##--} ;; - --onto) - onto=$2 - shift + --onto=*) + onto=${1#--onto=} ;; - -x) - cmd=${cmd}exec $2${LF} - shift + --exec=*) + cmd=${cmd}exec ${1#--exec=}${LF} ;; - -i) + --interactive) interactive_rebase=explicit ;; - -k) + --keep-empty) keep_empty=yes ;; - -p) + --preserve-merges) preserve_merges=t test -z $interactive_rebase interactive_rebase=implied ;; @@ -267,21 +265,19 @@ do --no-fork-point) fork_point= ;; - -m) + --merge) do_merge=t ;; - -X) - shift - strategy_opts=$strategy_opts $(git rev-parse --sq-quote --$1) + --strategy-option=*) + strategy_opts=$strategy_opts $(git rev-parse --sq-quote --${1#--strategy-option=}) do_merge=t test -z $strategy strategy=recursive ;; - -s) - shift - strategy=$1 + --strategy=*) + strategy=${1#--strategy=} do_merge=t ;; - -n) + --no-stat) diffstat= ;; --stat) @@ -290,21 +286,20 @@ do --autostash) autostash=true ;; - -v) + --verbose) verbose=t diffstat=t GIT_QUIET= ;; - -q) + --quiet) GIT_QUIET=t git_am_opt=$git_am_opt -q verbose= diffstat= ;; - --whitespace) - shift - git_am_opt=$git_am_opt --whitespace=$1 - case $1 in + --whitespace=*) + git_am_opt=$git_am_opt --whitespace=${1#--whitespace=} + case ${1#--whitespace=} in fix|strip) force_rebase=t ;; @@ -317,14 +312,13 @@ do git_am_opt=$git_am_opt $1 force_rebase=t ;; - -C) - shift - git_am_opt=$git_am_opt -C$1 + -C*) + git_am_opt=$git_am_opt $1 ;; --root) rebase_root=t ;; - -f|--no-ff) + --force-rebase|--no-ff) force_rebase=t ;; --rerere-autoupdate|--no-rerere-autoupdate) -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 7/9] rebase: parse options in stuck-long mode
On Mon, Feb 10, 2014 at 01:59:02AM -0500, Eric Sunshine wrote: On Sun, Feb 9, 2014 at 8:03 PM, brian m. carlson sand...@crustytoothpaste.net wrote: From: Nicolas Vigier bo...@mars-attacks.org There is no functionnal change. The reason for this change is to be able s/functionnal/functional/ I could have sworn I fixed that typo in the commit message. No, that was a different patch with the same typo. Sorry about that; I should have double-checked. I'm going to wait another day or so to see if anyone thinks other changes are needed, and then I'll do a reroll. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] contrib/diff-highlight: multibyte characters diff
On Wed, Feb 12, 2014 at 06:27:40PM -0500, Jeff King wrote: On Wed, Feb 12, 2014 at 11:10:49PM +, Thomas Adam wrote: On 12 February 2014 20:59, Jeff King p...@peff.net wrote: +sub decode { + my $orig = shift; + my $decoded = eval { decode_utf8($orig, Encode::FB_CROAK) }; + return defined $decoded ? I'd still advocate checking $@ here, rather than the defined $decoded check. I don't mind changing it, but for my edification, what is the advantage? The documentation for decode_utf8 isn't clear, but I don't know if it can ever return undef. What, for example, does it return if $orig is not defined? That's the benefit: it's immediately clear to the user that you're interested in whether it threw an exception, rather than whether it produced a given value. That said, $DAYJOB is a Perl shop, and I would certainly not reject this code in review, and depending on the situation, I might even write something like this. I personally think it's fine. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: Make the git codebase thread-safe
On Tue, Feb 11, 2014 at 05:54:51PM -0800, Stefan Zager wrote: To this end, I'd like to start submitting patches that make the code base generally more thread-safe and thread-friendly. Right after this email, I'm going to send the first such patch, which makes the global list of pack files (packed_git) internal to sha1_file.c. I'm definitely interested in this if it also works on POSIX systems. At work, we have a 7.6 GiB repo (packed)[0], so while performance is not bad, I certainly wouldn't object if it were better. [0] Using du -sh. For comparison, the Linux kernel repo is 1.4 GiB. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: git blame: Not Committed Yet with clean WD
On Thu, Feb 13, 2014 at 10:08:55AM +0100, Ephrim Khong wrote: Hi, for files that contain windows line endings in a repository with core.autocrlf=input, git blame will show lines as Not Committed Yet, even though they were not modified. Example: -- git init git config core.autocrlf false echo foo a unix2dos a git add a git commit -m initial commit git config core.autocrlf input git status git blame a -- Output: -- Reinitialized existing Git repository in /.../testblame2/.git/ unix2dos: converting file a to DOS format ... On branch master nothing to commit, working directory clean On branch master nothing to commit, working directory clean (Not Committed Yet 2014-02-13 10:02:43 +0100 1) foo -- Is there an easy way to work around this; is this desired behaviour or mor a bug? I'm pretty sure this is a bug. git blame should show the proper information in this case. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: Download of the latest release of git 1.8.5.5 does not work
On Fri, Feb 14, 2014 at 10:21:35AM +0100, Peter Marx wrote: Hello, On your web-side http://git-scm.com I see following information Latest stable release 1.8.5.5 Release Notes (2014-02-13) When I click on the link Download for Windows the page http://git-scm.com/download/win; is opened and the download of file Git-1.8.5.2-preview20131230.exe started. I would like to download the latest release 1.8.5.5 but this is not possible. Could you check your web-side and add the latest release to it. The version number is the version of the latest source release. On systems where code is not generally built directly from source (Mac OS X and Windows), independent groups of people build these versions and then upload them. You can always attempt to build the latest source yourself, though. Also, the git-scm.com site isn't maintained by the Git project; it's maintained at https://github.com/git/git-scm.com. What you're seeing appears to be issue #268 at that project: https://github.com/git/git-scm.com/issues/268. That's probably the most appropriate place to go. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: What's cooking in git.git (Feb 2014, #04; Wed, 12)
On Wed, Feb 12, 2014 at 01:59:41PM -0800, Junio C Hamano wrote: * bc/gpg-sign-everywhere (2014-02-11) 9 commits - pull: add the --gpg-sign option. - rebase: add the --gpg-sign option - rebase: parse options in stuck-long mode - rebase: don't try to match -M option - rebase: remove useless arguments check - am: add the --gpg-sign option - am: parse options in stuck-long mode - git-sh-setup.sh: add variable to use the stuck-long mode - cherry-pick, revert: add the --gpg-sign option Teach --gpg-sign option to many commands that create commits. Changes to some scripted Porcelains use unsafe variable substitutions and still need to be tightened. Will merge to 'next'. Junio, did you want a reroll with that fixed commit message, or will you fix it up yourself? -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH v5 7/9] rebase: parse options in stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org There is no functional change. The reason for this change is to be able to add a new option taking an optional argument. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 50 ++ 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index 3b55211..842d7d4 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -5,7 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC=\ git rebase [-i] [options] [--exec cmd] [--onto newbase] [upstream] [branch] git rebase [-i] [options] [--exec cmd] [--onto newbase] --root [branch] @@ -237,21 +237,19 @@ do test $total_argc -eq 2 || usage action=${1##--} ;; - --onto) - onto=$2 - shift + --onto=*) + onto=${1#--onto=} ;; - -x) - cmd=${cmd}exec $2${LF} - shift + --exec=*) + cmd=${cmd}exec ${1#--exec=}${LF} ;; - -i) + --interactive) interactive_rebase=explicit ;; - -k) + --keep-empty) keep_empty=yes ;; - -p) + --preserve-merges) preserve_merges=t test -z $interactive_rebase interactive_rebase=implied ;; @@ -267,21 +265,19 @@ do --no-fork-point) fork_point= ;; - -m) + --merge) do_merge=t ;; - -X) - shift - strategy_opts=$strategy_opts $(git rev-parse --sq-quote --$1) + --strategy-option=*) + strategy_opts=$strategy_opts $(git rev-parse --sq-quote --${1#--strategy-option=}) do_merge=t test -z $strategy strategy=recursive ;; - -s) - shift - strategy=$1 + --strategy=*) + strategy=${1#--strategy=} do_merge=t ;; - -n) + --no-stat) diffstat= ;; --stat) @@ -290,21 +286,20 @@ do --autostash) autostash=true ;; - -v) + --verbose) verbose=t diffstat=t GIT_QUIET= ;; - -q) + --quiet) GIT_QUIET=t git_am_opt=$git_am_opt -q verbose= diffstat= ;; - --whitespace) - shift - git_am_opt=$git_am_opt --whitespace=$1 - case $1 in + --whitespace=*) + git_am_opt=$git_am_opt --whitespace=${1#--whitespace=} + case ${1#--whitespace=} in fix|strip) force_rebase=t ;; @@ -317,14 +312,13 @@ do git_am_opt=$git_am_opt $1 force_rebase=t ;; - -C) - shift - git_am_opt=$git_am_opt -C$1 + -C*) + git_am_opt=$git_am_opt $1 ;; --root) rebase_root=t ;; - -f|--no-ff) + --force-rebase|--no-ff) force_rebase=t ;; --rerere-autoupdate|--no-rerere-autoupdate) -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 5/9] rebase: remove useless arguments check
From: Nicolas Vigier bo...@mars-attacks.org Remove a check on the number of arguments for --onto and -x options. It is not possible for $# to be = 2 at this point : - if --onto or -x has an argument, git rev-parse --parseopt will provide something like this : set -- --onto 'x' -- when parsing the --onto option, $# will be 3 or more if there are other options. - if --onto or -x doesn't have an argument, git rev-parse --parseopt will exit with an error and display usage information. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index c1f98ae..d1835ba 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -238,12 +238,10 @@ do action=${1##--} ;; --onto) - test 2 -le $# || usage onto=$2 shift ;; -x) - test 2 -le $# || usage cmd=${cmd}exec $2${LF} shift ;; -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 8/9] rebase: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-rebase.txt | 4 git-rebase--am.sh| 8 +--- git-rebase--interactive.sh | 39 ++- git-rebase--merge.sh | 2 +- git-rebase.sh| 11 +++ 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 2889be6..2a93c64 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -281,6 +281,10 @@ which makes little sense. specified, `-s recursive`. Note the reversal of 'ours' and 'theirs' as noted above for the `-m` option. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + -q:: --quiet:: Be quiet. Implies --no-stat. diff --git a/git-rebase--am.sh b/git-rebase--am.sh index a4f683a..df46f4c 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -6,7 +6,8 @@ case $action in continue) - git am --resolved --resolvemsg=$resolvemsg + git am --resolved --resolvemsg=$resolvemsg \ + ${gpg_sign_opt:+$gpg_sign_opt} move_to_original_branch return ;; @@ -26,7 +27,7 @@ then # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick # makes this easy - git cherry-pick --allow-empty $revisions + git cherry-pick ${gpg_sign_opt:+$gpg_sign_opt} --allow-empty $revisions ret=$? else rm -f $GIT_DIR/rebased-patches @@ -60,7 +61,8 @@ else return $? fi - git am $git_am_opt --rebasing --resolvemsg=$resolvemsg $GIT_DIR/rebased-patches + git am $git_am_opt --rebasing --resolvemsg=$resolvemsg \ + ${gpg_sign_opt:+$gpg_sign_opt} $GIT_DIR/rebased-patches ret=$? rm -f $GIT_DIR/rebased-patches diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 43c19e0..a1adae8 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -179,9 +179,10 @@ exit_with_patch () { echo $1 $state_dir/stopped-sha make_patch $1 git rev-parse --verify HEAD $amend + gpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote $gpg_sign_opt)} warn You can amend the commit now, with warn - warn git commit --amend + warn git commit --amend $gpg_sign_opt_quoted warn warn Once you are satisfied with your changes, run warn @@ -248,7 +249,9 @@ pick_one () { test -d $rewritten pick_one_preserving_merges $@ return - output eval git cherry-pick $strategy_args $empty_args $ff $@ + output eval git cherry-pick \ + ${gpg_sign_opt:+$(git rev-parse --sq-quote $gpg_sign_opt)} \ + $strategy_args $empty_args $ff $@ } pick_one_preserving_merges () { @@ -351,7 +354,8 @@ pick_one_preserving_merges () { new_parents=${new_parents# $first_parent} merge_args=--no-log --no-ff if ! do_with_author output eval \ - 'git merge $merge_args $strategy_args -m $msg_content $new_parents' + 'git merge ${gpg_sign_opt:+$gpg_sign_opt} \ + $merge_args $strategy_args -m $msg_content $new_parents' then printf %s\n $msg_content $GIT_DIR/MERGE_MSG die_with_patch $sha1 Error redoing merge $sha1 @@ -359,7 +363,9 @@ pick_one_preserving_merges () { echo $sha1 $(git rev-parse HEAD^0) $rewritten_list ;; *) - output eval git cherry-pick $strategy_args $@ || + output eval git cherry-pick \ + ${gpg_sign_opt:+$(git rev-parse --sq-quote $gpg_sign_opt)} \ + $strategy_args $@ || die_with_patch $sha1 Could not pick $sha1 ;; esac @@ -470,7 +476,8 @@ do_pick () { --no-post-rewrite -n -q -C $1 pick_one -n $1 git commit --allow-empty --allow-empty-message \ - --amend --no-post-rewrite -n -q -C $1 || + --amend --no-post-rewrite -n -q -C $1 \ + ${gpg_sign_opt:+$gpg_sign_opt} || die_with_patch $1 Could not apply $1... $2 else pick_one $1 || @@ -497,7 +504,7 @@ do_next () { mark_action_done do_pick $sha1 $rest - git commit --amend
[PATCH v5 4/9] am: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-am.txt | 6 +- git-am.sh| 9 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 54d8461..17924d0 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -14,7 +14,7 @@ SYNOPSIS [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=option] [-Cn] [-pn] [--directory=dir] [--exclude=path] [--include=path] [--reject] [-q | --quiet] -[--[no-]scissors] +[--[no-]scissors] [-S[keyid]] [(mbox | Maildir)...] 'git am' (--continue | --skip | --abort) @@ -119,6 +119,10 @@ default. You can use `--no-utf8` to override this. Skip the current patch. This is only meaningful when restarting an aborted patch. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + --continue:: -r:: --resolved:: diff --git a/git-am.sh b/git-am.sh index 020abf6..78517f2 100755 --- a/git-am.sh +++ b/git-am.sh @@ -38,6 +38,7 @@ abort restore the original branch and abort the patching operation. committer-date-is-author-datelie about committer date ignore-date use current timestamp for author date rerere-autoupdate update the index with reused conflict resolution if possible +S,gpg-sign? GPG-sign commits rebasing* (internal use for git-rebase) . git-sh-setup @@ -375,6 +376,7 @@ git_apply_opt= committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= +gpg_sign_opt= if test $(git config --bool --get am.keepcr) = true then @@ -436,6 +438,10 @@ it will be removed. Please do not use it anymore. keepcr=t ;; --no-keep-cr) keepcr=f ;; + --gpg-sign) + gpg_sign_opt=-S ;; + --gpg-sign=*) + gpg_sign_opt=-S${1#--gpg-sign=} ;; --) shift; break ;; *) @@ -900,7 +906,8 @@ did you forget to use 'git add'? GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE export GIT_COMMITTER_DATE fi - git commit-tree $tree ${parent:+-p} $parent $dotest/final-commit + git commit-tree ${parent:+-p} $parent ${gpg_sign_opt:+$gpg_sign_opt} $tree \ + $dotest/final-commit ) git update-ref -m $GIT_REFLOG_ACTION: $FIRSTLINE HEAD $commit $parent || stop_here $this -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 3/9] am: parse options in stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org There is no functional change. The reason for this change is to be able to add a new option taking an optional argument. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-am.sh | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/git-am.sh b/git-am.sh index a3b6f98..020abf6 100755 --- a/git-am.sh +++ b/git-am.sh @@ -4,7 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC=\ git am [options] [(mbox|Maildir)...] git am [options] (--continue | --skip | --abort) @@ -414,14 +414,14 @@ it will be removed. Please do not use it anymore. abort=t ;; --rebasing) rebasing=t threeway=t ;; - --resolvemsg) - shift; resolvemsg=$1 ;; - --whitespace|--directory|--exclude|--include) - git_apply_opt=$git_apply_opt $(sq $1=$2); shift ;; - -C|-p) - git_apply_opt=$git_apply_opt $(sq $1$2); shift ;; - --patch-format) - shift ; patch_format=$1 ;; + --resolvemsg=*) + resolvemsg=${1#--resolvemsg=} ;; + --whitespace=*|--directory=*|--exclude=*|--include=*) + git_apply_opt=$git_apply_opt $(sq $1) ;; + -C*|-p*) + git_apply_opt=$git_apply_opt $(sq $1) ;; + --patch-format=*) + patch_format=${1#--patch-format=} ;; --reject|--ignore-whitespace|--ignore-space-change) git_apply_opt=$git_apply_opt $1 ;; --committer-date-is-author-date) -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 6/9] rebase: don't try to match -M option
From: Nicolas Vigier bo...@mars-attacks.org The -M option does not exist in OPTIONS_SPEC, so there is no use to try to find it. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-rebase.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-rebase.sh b/git-rebase.sh index d1835ba..3b55211 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -267,7 +267,7 @@ do --no-fork-point) fork_point= ;; - -M|-m) + -m) do_merge=t ;; -X) -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 9/9] pull: add the --gpg-sign option.
git merge already allows us to sign commits, and git rebase has recently learned how to do so as well. Teach git pull to parse the -S/--gpg-sign option and pass this along to merge or rebase, as appropriate. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- git-pull.sh | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/git-pull.sh b/git-pull.sh index 0a5aa2c..6986e0f 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -138,6 +138,15 @@ do --no-verify-signatures) verify_signatures=--no-verify-signatures ;; + --gpg-sign|-S) + gpg_sign_args=-S + ;; + --gpg-sign=*) + gpg_sign_args=$(git rev-parse --sq-quote -S${1#--gpg-sign=}) + ;; + -S*) + gpg_sign_args=$(git rev-parse --sq-quote $1) + ;; --d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run) dry_run=--dry-run ;; @@ -305,11 +314,13 @@ merge_name=$(git fmt-merge-msg $log_arg $GIT_DIR/FETCH_HEAD) || exit case $rebase in true) eval=git-rebase $diffstat $strategy_args $merge_args $rebase_args $verbosity + eval=$eval $gpg_sign_args eval=$eval --onto $merge_head ${oldremoteref:-$merge_head} ;; *) eval=git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only - eval=$eval $log_arg $strategy_args $merge_args $verbosity $progress + eval=$eval $log_arg $strategy_args $merge_args $verbosity $progress + eval=$eval $gpg_sign_args eval=$eval \\$merge_name\ HEAD $merge_head ;; esac -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 1/9] cherry-pick, revert: add the --gpg-sign option
From: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Documentation/git-cherry-pick.txt | 7 ++- Documentation/git-revert.txt | 6 +- builtin/revert.c | 2 ++ sequencer.c | 11 +++ sequencer.h | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index c205d23..f1e6b2f 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS [verse] -'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... +'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] + [-S[keyid]] commit... 'git cherry-pick' --continue 'git cherry-pick' --quit 'git cherry-pick' --abort @@ -100,6 +101,10 @@ effect to your index in a row. --signoff:: Add Signed-off-by line at the end of the commit message. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + --ff:: If the current HEAD is the same as the parent of the cherry-pick'ed commit, then a fast forward to this commit will diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index 2de67a5..9eb83f0 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -8,7 +8,7 @@ git-revert - Revert some existing commits SYNOPSIS [verse] -'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] commit... +'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[keyid]] commit... 'git revert' --continue 'git revert' --quit 'git revert' --abort @@ -80,6 +80,10 @@ more details. This is useful when reverting more than one commits' effect to your index in a row. +-S[keyid]:: +--gpg-sign[=keyid]:: + GPG-sign commits. + -s:: --signoff:: Add Signed-off-by line at the end of the commit message. diff --git a/builtin/revert.c b/builtin/revert.c index 87659c9..065d88d 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_STRING(0, strategy, opts-strategy, N_(strategy), N_(merge strategy)), OPT_CALLBACK('X', strategy-option, opts, N_(option), N_(option for merge strategy), option_parse_x), + { OPTION_STRING, 'S', gpg-sign, opts-gpg_sign, N_(key id), + N_(GPG sign commit), PARSE_OPT_OPTARG, NULL, (intptr_t) }, OPT_END(), OPT_END(), OPT_END(), diff --git a/sequencer.c b/sequencer.c index 90cac7b..bde5f04 100644 --- a/sequencer.c +++ b/sequencer.c @@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, { struct argv_array array; int rc; + char *gpg_sign; argv_array_init(array); argv_array_push(array, commit); argv_array_push(array, -n); + if (opts-gpg_sign) { + gpg_sign = xmalloc(3 + strlen(opts-gpg_sign)); + sprintf(gpg_sign, -S%s, opts-gpg_sign); + argv_array_push(array, gpg_sign); + free(gpg_sign); + } if (opts-signoff) argv_array_push(array, -s); if (!opts-edit) { @@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data) opts-mainline = git_config_int(key, value); else if (!strcmp(key, options.strategy)) git_config_string(opts-strategy, key, value); + else if (!strcmp(key, options.gpg-sign)) + git_config_string(opts-gpg_sign, key, value); else if (!strcmp(key, options.strategy-option)) { ALLOC_GROW(opts-xopts, opts-xopts_nr + 1, opts-xopts_alloc); opts-xopts[opts-xopts_nr++] = xstrdup(value); @@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts) } if (opts-strategy) git_config_set_in_file(opts_file, options.strategy, opts-strategy); + if (opts-gpg_sign) + git_config_set_in_file(opts_file, options.gpg-sign, opts-gpg_sign); if (opts-xopts) { int i; for (i = 0; i opts-xopts_nr; i++) diff --git a/sequencer.h b/sequencer.h index 1fc22dc..db43e9c 100644 --- a/sequencer.h +++ b/sequencer.h @@ -37,6 +37,8 @@ struct replay_opts { int mainline; + const char *gpg_sign; + /* Merge strategy */ const char *strategy; const char **xopts; -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo
[PATCH v5 2/9] git-sh-setup.sh: add variable to use the stuck-long mode
From: Nicolas Vigier bo...@mars-attacks.org If the variable $OPTIONS_STUCKLONG is not empty, then rev-parse option parsing is done in --stuck-long mode. Signed-off-by: Nicolas Vigier bo...@mars-attacks.org Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- contrib/git-resurrect.sh | 1 + git-am.sh| 1 + git-instaweb.sh | 1 + git-quiltimport.sh | 1 + git-rebase.sh| 1 + git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ 7 files changed, 8 insertions(+) diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh index a4ed4c3..d7e97bb 100755 --- a/contrib/git-resurrect.sh +++ b/contrib/git-resurrect.sh @@ -10,6 +10,7 @@ is rather slow but allows you to resurrect other people's topic branches. OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git resurrect $USAGE -- diff --git a/git-am.sh b/git-am.sh index bbea430..a3b6f98 100755 --- a/git-am.sh +++ b/git-am.sh @@ -4,6 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git am [options] [(mbox|Maildir)...] git am [options] (--continue | --skip | --abort) diff --git a/git-instaweb.sh b/git-instaweb.sh index e93a238..4aa3eb8 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -5,6 +5,7 @@ PERL='@@PERL@@' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git instaweb [options] (--start | --stop | --restart) -- diff --git a/git-quiltimport.sh b/git-quiltimport.sh index 8e17525..167d79f 100755 --- a/git-quiltimport.sh +++ b/git-quiltimport.sh @@ -1,5 +1,6 @@ #!/bin/sh OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git quiltimport [options] -- diff --git a/git-rebase.sh b/git-rebase.sh index 8a3efa2..c1f98ae 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -5,6 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC=\ git rebase [-i] [options] [--exec cmd] [--onto newbase] [upstream] [branch] git rebase [-i] [options] [--exec cmd] [--onto newbase] --root [branch] diff --git a/git-request-pull.sh b/git-request-pull.sh index fe21d5d..cf4f150 100755 --- a/git-request-pull.sh +++ b/git-request-pull.sh @@ -9,6 +9,7 @@ LONG_USAGE='Summarizes the changes between two commits to the standard output, and includes the given URL in the generated summary.' SUBDIRECTORY_OK='Yes' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC='git request-pull [options] start url [end] -- pshow patch text as well diff --git a/git-sh-setup.sh b/git-sh-setup.sh index fffa3c7..5f28b32 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -72,6 +72,8 @@ if test -n $OPTIONS_SPEC; then parseopt_extra= [ -n $OPTIONS_KEEPDASHDASH ] parseopt_extra=--keep-dashdash + [ -n $OPTIONS_STUCKLONG ] + parseopt_extra=$parseopt_extra --stuck-long eval $( echo $OPTIONS_SPEC | -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 0/9] add --gpg-sign to rebase and pull
This series was posted to the list some time back. This is a re-send of Nicolas Vigier's work with an additional patch that adds --gpg-sign to pull as well, as well as the fixes that Junio suggested in review for v3 and a typo noted in the v4 series. There is also one additional merge call that was not previously given a signature option that is now provided one as of v4. I believe this was an oversight, so I fixed it. Nicolas Vigier (8): cherry-pick, revert: add the --gpg-sign option git-sh-setup.sh: add variable to use the stuck-long mode am: parse options in stuck-long mode am: add the --gpg-sign option rebase: remove useless arguments check rebase: don't try to match -M option rebase: parse options in stuck-long mode rebase: add the --gpg-sign option brian m. carlson (1): pull: add the --gpg-sign option. Documentation/git-am.txt | 6 +++- Documentation/git-cherry-pick.txt | 7 - Documentation/git-rebase.txt | 4 +++ Documentation/git-revert.txt | 6 +++- builtin/revert.c | 2 ++ contrib/git-resurrect.sh | 1 + git-am.sh | 26 ++-- git-instaweb.sh | 1 + git-pull.sh | 13 +++- git-quiltimport.sh| 1 + git-rebase--am.sh | 8 +++-- git-rebase--interactive.sh| 39 git-rebase--merge.sh | 2 +- git-rebase.sh | 62 +-- git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ sequencer.c | 11 +++ sequencer.h | 2 ++ 18 files changed, 135 insertions(+), 59 deletions(-) -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] wt-status.c: make cut_lines[] const to shrink .data section a bit
On Sun, Feb 16, 2014 at 10:37:18AM +0700, Nguyễn Thái Ngọc Duy wrote: -static char cut_line[] = +static const char cut_line[] = Your subject says cut_lines[], but the variable is cut_line[] (no s). -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: Wrong version of Git on your download website for windows
On Mon, Feb 17, 2014 at 04:45:20PM +0100, Dr. Torsten Thurow wrote: Hello, many thanks for all your working. Git is a very good help tool. A smal bug is on your download website for windows. Here we can read: Latest stable release 1.9.0 Release Notes (2014-02-14) Download for Windows, but the link loads Git-1.8.5.2.preview20131230.exe Windows and Mac OS X binary builds are done by a different group and uploaded as they get the time, and as such, the version number is that of the source, not the binaries. Also, the git-scm.com website is maintained by other people, not the Git project itself. The fact that that website has confusing information for binary builds is tracked in that site's issue #268: https://github.com/git/git-scm.com/issues/268. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] revert.c: Allow to specify -x via git-config
On Tue, Feb 18, 2014 at 09:49:13AM -0800, Jonathan Nieder wrote: Can you say more about the context? Why is it important to record the original commit id? Is it a matter of keeping a reminder of the commits' similarity (which cherry-pick without '-x' does ok by reusing the same message) or are people reviewing the change downstream going to be judging the change based on the recorded upstream commit id? (Like linux's stable-version branches --- but those have other requirements so I don't think this configuration would work as is there.) I can provide a use case. At work, we merge into the maintenance and development branches and cherry-pick from the maintenance to the stable branches. We want committers to always use -x -s because we need to know which reviewer backported the change and we want to be able to track which commits have been backported and whether any reverts also need to be cherry-picked. We also have automated tools that want this information. I usually solve this with an alias (backport = cherry-pick -x -s), but I can see how this might be a useful option. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH] blame: add a failing test for a CRLF issue.
If a file contains CRLF line endings in a repository with core.autocrlf=input, then blame always marks the lines as Not Committed Yet, even if they are unmodified. Add a failing test for this case, so we are at least aware of this issue. Reported-by: Ephrim Khong dr.kh...@gmail.com Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- Obviously, this doesn't actually fix the issue, but at least we're aware of it so we don't lose track of it and can fix it. A future patch can mark the test passing. t/t8003-blame-corner-cases.sh | 10 ++ 1 file changed, 10 insertions(+) diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh index e7cac1d..903f775 100755 --- a/t/t8003-blame-corner-cases.sh +++ b/t/t8003-blame-corner-cases.sh @@ -191,4 +191,14 @@ test_expect_success 'indent of line numbers, ten lines' ' test $(grep -cactual) = 9 ' +test_expect_failure 'blaming files with CRLF newlines' ' + git config core.autocrlf false + printf testcase\r\n crlffile + git add crlffile + git commit -m testcase + git config core.autocrlf input + git blame crlffile actual + grep A U Thor actual +' + test_done -- 1.9.0.rc3.1008.gd08b47c.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: `git stash pop` UX Problem
On Tue, Feb 25, 2014 at 01:33:56PM +0100, Matthieu Moy wrote: Holger Hellmuth hellm...@ira.uka.de writes: Maybe status should display a stash count if that count is 0, as this is part of the state of the repo. Maybe it would help some users, but not me for example. My main use of git stash is a safe replacement for git reset --hard: when I want to discard changes, but keep them safe just in case. So, my stash count is almost always 0, and I don't want to hear about it. I concur with this. Sometimes the stashed changes are remnants of a small hack or a very brief start to an aborted project that I stashed when I needed to change branches. I figure that they might be useful in the future, but I don't care about them right now. I may pick them up, I may not, but I certainly don't want to be reminded of them constantly. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH 1/2] t3200-branch: test setting branch as own upstream
On Fri, Feb 28, 2014 at 01:27:15AM -0500, Jeff King wrote: On Fri, Feb 28, 2014 at 03:17:28PM +0900, Brian Gesiak wrote: Patch is on the way, just waiting for the tests to complete. Thanks for pointing that out! Also, sorry if it's in the Makefile somewhere, but is there an easy way to run just a single test file in the t directory? You can run ./t-sh explicitly. You can also use Perl's prove command, which provides some nice-to-have features, such as exiting abnormally if your tests abort prematurely. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] Place cache.h at the first place to match generl rule
On Sat, Mar 01, 2014 at 11:05:23PM +0800, Sun He wrote: Signed-off-by: Sun He sunheeh...@gmail.com Helped-by: Duy Nguyen pclo...@gmail.com Your commit summary has generl instead of general. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: git 1.9.0 segfault
On Sat, Mar 08, 2014 at 04:23:43PM +, Guillaume Gelin wrote: Hi, http://pastebin.com/Np7L54ar I can confirm this. I get the following backtrace: Core was generated by `/home/bmc/checkouts/git/git mv packages/ lisp'. Program terminated with signal 11, Segmentation fault. #0 0x7fe31a4371b2 in _IO_vfprintf_internal (s=s@entry=0x7fffa330d2e0, format=optimized out, format@entry=0x7fffa330e5b0 renaming '%s' failed: Bad address, ap=ap@entry=0x7fffa330e498) at vfprintf.c:1649 1649 vfprintf.c: No such file or directory. (gdb) bt #0 0x7fe31a4371b2 in _IO_vfprintf_internal (s=s@entry=0x7fffa330d2e0, format=optimized out, format@entry=0x7fffa330e5b0 renaming '%s' failed: Bad address, ap=ap@entry=0x7fffa330e498) at vfprintf.c:1649 #1 0x7fe31a4e2315 in ___vsnprintf_chk (s=s@entry=0x7fffa330d450 renaming '0\243\377\177, maxlen=optimized out, maxlen@entry=4096, flags=flags@entry=1, slen=slen@entry=4096, format=0x7fffa330e5b0 renaming '%s' failed: Bad address, format@entry=0x544fe5 fatal: , args=0x7fffa330e498) at vsnprintf_chk.c:63 #2 0x005041cb in vsnprintf (__ap=optimized out, __fmt=0x544fe5 fatal: , __n=4096, __s=0x7fffa330d450 renaming '0\243\377\177) at /usr/include/x86_64-linux-gnu/bits/stdio2.h:77 #3 vreportf (prefix=prefix@entry=0x544fe5 fatal: , err=optimized out, params=optimized out) at usage.c:12 #4 0x00504224 in die_builtin (err=optimized out, params=optimized out) at usage.c:36 #5 0x00504650 in die_errno (fmt=0x52be9a renaming '%s' failed) at usage.c:137 #6 0x0044cb4d in cmd_mv (argc=optimized out, argv=optimized out, prefix=optimized out) at builtin/mv.c:246 #7 0x0040602d in run_builtin (argv=0x7fffa330ef90, argc=3, p=0x779d40 commands+1536) at git.c:314 #8 handle_builtin (argc=3, argv=0x7fffa330ef90) at git.c:487 #9 0x004052e1 in run_argv (argv=0x7fffa330ee48, argcp=0x7fffa330ee2c) at git.c:533 #10 main (argc=3, av=optimized out) at git.c:616 We're failing to rename because we got an EFAULT, and then we try to print the failing filename, and we get a segfault right here: if (rename(src, dst) 0 !ignore_errors) die_errno (_(renaming '%s' failed), src); I don't know yet if dst is also bad, but clearly src is. I'm looking into it. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] builtin/mv: fix out of bounds write
On Sat, Mar 08, 2014 at 06:35:01PM +, John Keeping wrote: When commit a88c915 (mv: move submodules using a gitfile, 2013-07-30) added the submodule_gitfile array, it was not added to the block that enlarges the arrays when we are moving a directory so that we do not have to worry about it being a directory when we perform the actual move. After this, the loop continues over the enlarged set of sources. Since we assume that submodule_gitfile has size argc, if any of the items in the source directory are submodules we are guaranteed to write beyond the end of submodule_gitfile. Fix this by realloc'ing submodule_gitfile at the same time as the other arrays. Reported-by: Guillaume Gelin cont...@ramnes.eu Signed-off-by: John Keeping j...@keeping.me.uk --- On Sat, Mar 08, 2014 at 06:12:18PM +, John Keeping wrote: This fixes it for me: Here it is as a proper patch. builtin/mv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/mv.c b/builtin/mv.c index 21c46d1..f99c91e 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -179,6 +179,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix) modes = xrealloc(modes, (argc + last - first) * sizeof(enum update_mode)); + submodule_gitfile = xrealloc(submodule_gitfile, + (argc + last - first) + * sizeof(char *)); } dst = add_slash(dst); Yup, that's the same conclusion I came to. There are also two cases where we don't shrink the array properly. I'll rebase my patch on top of this one and send it. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH] mv: prevent mismatched data when ignoring errors.
We shrink the source and destination arrays, but not the modes or submodule_gitfile arrays, resulting in potentially mismatched data. Shrink all the arrays at the same time to prevent this. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- builtin/mv.c | 5 + 1 file changed, 5 insertions(+) diff --git a/builtin/mv.c b/builtin/mv.c index f99c91e..b20cd95 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix) memmove(destination + i, destination + i + 1, (argc - i) * sizeof(char *)); + memmove(modes + i, modes + i + 1, + (argc - i) * sizeof(char *)); + memmove(submodule_gitfile + i, + submodule_gitfile + i + 1, + (argc - i) * sizeof(char *)); i--; } } else -- 1.9.0.1010.g6633b85.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/7] run-command: mark run_hook_with_custom_index as deprecated
On Mon, Mar 10, 2014 at 07:49:37PM +0100, Benoit Pierre wrote: --- run-command.h | 1 + 1 file changed, 1 insertion(+) diff --git a/run-command.h b/run-command.h index 88460f9..3653bfa 100644 --- a/run-command.h +++ b/run-command.h @@ -51,6 +51,7 @@ extern int run_hook_le(const char *const *env, const char *name, ...); extern int run_hook_ve(const char *const *env, const char *name, va_list args); LAST_ARG_MUST_BE_NULL +__attribute__((deprecated)) It doesn't appear that we use the deprecated attribute anywhere else in the code. Wouldn't it just be better to change the places that use this and then remove the function altogether? I imagine your current patch might introduce a number of warnings that some people would rather avoid. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] mv: prevent mismatched data when ignoring errors.
On Mon, Mar 10, 2014 at 09:56:03PM -0400, Jeff King wrote: On Sat, Mar 08, 2014 at 07:21:39PM +, brian m. carlson wrote: We shrink the source and destination arrays, but not the modes or submodule_gitfile arrays, resulting in potentially mismatched data. Shrink all the arrays at the same time to prevent this. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- builtin/mv.c | 5 + 1 file changed, 5 insertions(+) diff --git a/builtin/mv.c b/builtin/mv.c index f99c91e..b20cd95 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix) memmove(destination + i, destination + i + 1, (argc - i) * sizeof(char *)); + memmove(modes + i, modes + i + 1, + (argc - i) * sizeof(char *)); + memmove(submodule_gitfile + i, + submodule_gitfile + i + 1, + (argc - i) * sizeof(char *)); I haven't looked that closely, but would it be crazy to suggest that these arrays all be squashed into one array-of-struct? It would be less error prone and perhaps more readable. I was thinking of doing exactly that, but the way internal_copy_pathspec is written, I'd need to use offsetof to have it write to the right structure members. That's a bit more gross than I wanted, but I'll probably implement it at some point during the upcoming week. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] mv: prevent mismatched data when ignoring errors.
On Tue, Mar 11, 2014 at 02:45:59PM -0700, Junio C Hamano wrote: Thanks. Neither this nor John's seems to describe the user-visible way to trigger the symptom. Can we have tests for them? I'll try to get to writing some test today or tomorrow. I just noticed the bugginess by looking at the code, so I'll need to actually spend time reproducing the problem. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH v2] mv: prevent mismatched data when ignoring errors.
We shrink the source and destination arrays, but not the modes or submodule_gitfile arrays, resulting in potentially mismatched data. Shrink all the arrays at the same time to prevent this. Add tests to ensure the problem does not recur. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- I attempted to come up with a second patch that would refactor out the four different arrays into one array of struct, as Jeff suggested, but it became very ugly very quickly. So this patch simply fixes the problem and adds tests. builtin/mv.c | 5 + t/t7001-mv.sh | 13 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/builtin/mv.c b/builtin/mv.c index f99c91e..09bbc63 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix) memmove(destination + i, destination + i + 1, (argc - i) * sizeof(char *)); + memmove(modes + i, modes + i + 1, + (argc - i) * sizeof(enum update_mode)); + memmove(submodule_gitfile + i, + submodule_gitfile + i + 1, + (argc - i) * sizeof(char *)); i--; } } else diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index e3c8c2c..215d43d 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -294,7 +294,8 @@ test_expect_success 'setup submodule' ' git submodule add ./. sub echo content file git add file - git commit -m added sub and file + git commit -m added sub and file + git branch submodule ' test_expect_success 'git mv cannot move a submodule in a file' ' @@ -463,4 +464,14 @@ test_expect_success 'checking out a commit before submodule moved needs manual u ! test -s actual ' +test_expect_success 'mv -k does not accidentally destroy submodules' ' + git checkout submodule + mkdir dummy dest + git mv -k dummy sub dest + git status --porcelain actual + grep ^R sub - dest/sub actual + git reset --hard + git checkout . +' + test_done -- 1.9.0.1010.g6633b85.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] send-email: recognize absolute path on Windows
On Wed, Apr 16, 2014 at 10:19:54AM -0700, Junio C Hamano wrote: Ahh, OK, if you did so, you won't have any place to hook the only on msys do this trick into. It somehow feels somewhat confusing that we define a sub with the same name as the system one, while not overriding it entirely but delegate back to the system one. I am debating myself if it is more obvious if it is done this way: use File::Spec::Functions qw(file_name_is_absolute); if ($^O eq 'msys') { You would probably want a no warnings 'redefine' here as well. sub file_name_is_absolute { return $_[0] =~ /^\// || $_[0] =~ /^[A-Z]:/i; } } -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: user.signingkey without gpg? (using s/mime or ssh?)
On Fri, Apr 18, 2014 at 10:04:50PM +0200, Thomas Schittli wrote: We already have trusted Certificates from a CA. Can we use them instead of an additional PGP key? Git wants a key that can be used by GnuPG, and X.509 certificates can't be. It invokes the gpg binary that's in your path, so X.509 integration isn't possible unless gpg learns about it. We already have: - s/mime certificate - web server ssl/tls certificate - XMPP Jabber ssl/tls certificate - Object Code Signing certificate Or if we have to use a new pgp key: can we sign it using any of our certificates? Only in the sense that you can sign any arbitrary piece of text or data with your certificates. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Refactoring hardcoded SHA-1 constants
SHA-1 is clearly on its way out. I know that there has been discussion in the past about moving to different algorithms. I'm not interested in having that discussion now. I'd like to introduce a set of preprocessor constants that we'd use instead of hard-coded 20s and 40s everywhere. That way, if we decide to support a different algorithm, doing so becomes significantly easier. These would be used in new code. After that, I'd like to slowly start moving existing code to use these constants. I would also like to consider, as a third step, turning all of the unsigned char[20] uses into a struct containing unsigned char[20] as its only member, like libgit2 does. This disambiguates arbitrary byte data from byte sequences being used to represent an SHA-1 ID. I'm hoping the first suggestion will be mostly unobjectionable, as having hard-coded constants is widely considered bad programming practice. I suspect the latter two will be more controversial. These changes, if implemented, would be done by hand, not by machine, and they would be bisectable. Comments? -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: What's cooking in git.git (Apr 2014, #07; Tue, 22)
On Tue, Apr 22, 2014 at 04:12:42PM -0700, Junio C Hamano wrote: * bc/blame-crlf-test (2014-02-18) 1 commit - blame: add a failing test for a CRLF issue. I have a feeling that a fix for this should be fairly isolated and trivial (it should be just the matter of paying attention to the crlf settings when synthesizing the fake commit)---perhaps somebody can squash in a fix to this? Last time I looked at this, I couldn't come up with an obvious fix for the problem, or I would have included one. I'll try to have another go at it this weekend. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH 04/14] appp.sh: use the $( ... ) construct for command substitution
On Wed, Apr 23, 2014 at 06:43:56AM -0700, Elia Pinto wrote: @@ -25,11 +25,11 @@ fi cd - /dev/null -SUBJECT=`sed -n -e '/^Subject: /p' ${PATCH}` -HEADERS=`sed -e '/^'${SEP}'$/,$d' $1` -BODY=`sed -e 1,/${SEP}/d $1` -CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' ${PATCH}` -DIFF=`sed -e '1,/^---$/d' ${PATCH}` +SUBJECT=$(sed -n -e '/^Subject: /p' ${PATCH}) +HEADERS=$(sed -e '/^'${SEP}'$/,$d' $1) +BODY=$(sed -e 1,/${SEP}/d $1) +CMT_MSG=$(sed -e '1,/^$/d' -e '/^---$/,$d' ${PATCH}) +DIFF=$(sed -e '1,/^---$/d' ${PATCH}) CCS=`echo -e $CMT_MSG\n$HEADERS | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \ -e 's/^Signed-off-by: \(.*\)/\1,/gp'` It looks like you may have missed a usage here due to the line break. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: GIT, libcurl and GSS-Negotiate
On Thu, Apr 24, 2014 at 07:17:36PM +0200, Ivo Bellin Salarin wrote: To shortly resume it, the problem is that: * when the authentication method (WWW-Authenticate) is Negotiate AND * when the server proposes a NTLMSSP_CHALLENGE in response of the client's NTLMSSP_NEGOTIATE, = libcurl yields an Authentication problem. Ignoring this.\n And the communication is closed. At this point, in a normal communication, the client should send a NTLMSSP_AUTH containing a Kerberos ticket. Having seen the libcurl source code, I think we're passing through the lines from 776 to 780 of [http.c](https://github.com/bagder/curl/blob/2e57c7e0fcfb9214b2a9dfa8b3da258ded013b8a/lib/http.c). Some guy, on the github issue page, has suggested that this could be related to an update of libcurl, when git was at its 1.8.2 version. I'm not debugging libcurl, and I can't reproduce this problem @home. So, has somebody already experienced the same problem? Is there a solution? I'm personally using Git with GSS-Negotiate (and MIT Kerberos 5) and it does seem to work correctly for me. For large pushes, your server (and any intermediate proxies) will need to support 100 Continue properly, as there's simply no other way to make it work. What version of curl are you using (and what distro if you didn't compile it yourself)? Also, can you post output of an attempt to push with GIT_CURL_VERBOSE=1? -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH v2] blame: correctly handle files regardless of autocrlf.
If a file contained CRLF line endings in a repository with core.autocrlf=input, then blame always marked lines as Not Committed Yet, even if they were unmodified. Don't attempt to convert the line endings when creating the fake commit so that blame works correctly regardless of the autocrlf setting. Reported-by: Ephrim Khong dr.kh...@gmail.com Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- On Tue, Apr 22, 2014 at 04:12:42PM -0700, Junio C Hamano wrote: I have a feeling that a fix for this should be fairly isolated and trivial (it should be just the matter of paying attention to the crlf settings when synthesizing the fake commit)---perhaps somebody can squash in a fix to this? Last time I looked at this, I couldn't come up with an obvious fix for the problem, or I would have included one. I'll try to have another go at it this weekend. This was actually a very helpful hint, Junio. Thanks for the push in the right direction. This includes the suggestion by Torsten Bögershausen to use the git -c for the blame command. builtin/blame.c | 1 - t/t8003-blame-corner-cases.sh | 9 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/builtin/blame.c b/builtin/blame.c index 88cb799..eef3e86 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2088,7 +2088,6 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt, if (strbuf_read(buf, 0, 0) 0) die_errno(failed to read from stdin); } - convert_to_git(path, buf.buf, buf.len, buf, 0); origin-file.ptr = buf.buf; origin-file.size = buf.len; pretend_sha1_file(buf.buf, buf.len, OBJ_BLOB, origin-blob_sha1); diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh index e7cac1d..2a3469b 100755 --- a/t/t8003-blame-corner-cases.sh +++ b/t/t8003-blame-corner-cases.sh @@ -191,4 +191,13 @@ test_expect_success 'indent of line numbers, ten lines' ' test $(grep -cactual) = 9 ' +test_expect_success 'blaming files with CRLF newlines' ' + git config core.autocrlf false + printf testcase\r\n crlffile + git add crlffile + git commit -m testcase + git -c core.autocrlf=input blame crlffile actual + grep A U Thor actual +' + test_done -- 2.0.0.rc0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Pull is Evil
On Wed, Apr 30, 2014 at 05:25:59PM -0500, Felipe Contreras wrote: Marc Branchaud wrote: On 14-04-30 04:14 PM, Felipe Contreras wrote: What is wrong when `git pull` merges a fast-forward? Nothing. Everything. It depends. It depends on what? I don't see how a fast-forward `git pull` could possibly have any trouble. The problems with `git pull` come when you can't do a fast-forward merge, right? Some of them, maybe most of them. Name one problem with a fast-forward merge. At work, we have a workflow where we merge topic branches as non-fast-forward, so that we have a record of the history (including who reviewed the code), but when we want to just update our local branches, we always want fast-forward: git checkout maintenance-branch # Update our maintenance branch to the latest from the main repo. git pull --ff-only git pull --no-ff developer-remote topic-branch git push main-repo HEAD So there are times when fast-forward merges are the right thing, and times when they're not, and as you can see, this depends on context and isn't per-repository. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH] Define constants for lengths of object names
Using preprocessor constants rather than hardcoded numbers is considered a good programming practice. Provide two constants, GIT_OID_RAWSZ and GIT_OID_HEXSZ, which are the lengths of an SHA-1 object name in bytes and hex digits, respectively. These names are the same as those used by libgit2. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- object.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/object.h b/object.h index 6e12f2c..f1cff2d 100644 --- a/object.h +++ b/object.h @@ -1,6 +1,13 @@ #ifndef OBJECT_H #define OBJECT_H +/* + * The length in bytes and in hex digits of an object name (SHA-1 value). + * These are the same names used by libgit2. + */ +#define GIT_OID_RAWSZ 20 +#define GIT_OID_HEXSZ 40 + struct object_list { struct object *item; struct object_list *next; @@ -49,7 +56,7 @@ struct object { unsigned used : 1; unsigned type : TYPE_BITS; unsigned flags : FLAG_BITS; - unsigned char sha1[20]; + unsigned char sha1[GIT_OID_RAWSZ]; }; extern const char *typename(unsigned int type); -- 2.0.0.rc0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Define constants for lengths of object names
On Thu, May 01, 2014 at 10:20:07AM -0700, Jonathan Nieder wrote: Hi, brian m. carlson wrote: --- a/object.h +++ b/object.h [...] @@ -49,7 +56,7 @@ struct object { unsigned used : 1; unsigned type : TYPE_BITS; unsigned flags : FLAG_BITS; - unsigned char sha1[20]; + unsigned char sha1[GIT_OID_RAWSZ]; Maybe my brain has been damaged by reading code from too many C projects that hard-code some constants, but I find '20' easier to read here. What happened to the struct object_id { unsigned char id[20]; }; ... struct object { ... struct object_id id; }; idea? There didn't seem to be a huge amount of support for it. Also, there were concerns that some architectures might impose alignment constraints on it that made sizeof(struct object_id) != 20. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [git] Re: Pull is Evil
On Thu, May 01, 2014 at 02:04:33PM -0400, Marc Branchaud wrote: On 14-05-01 01:56 PM, W. Trevor King wrote: On Thu, May 01, 2014 at 11:20:44AM -0400, Marc Branchaud wrote: On 14-05-01 05:46 AM, brian m. carlson wrote: git checkout maintenance-branch # Update our maintenance branch to the latest from the main repo. git pull --ff-only git pull --no-ff developer-remote topic-branch git push main-repo HEAD … What's more, it seems to me that the only real advantage git pull provides here is a less typing compared to the non-pull equivalent: git fetch main-repo git checkout main-repo/maintenance-branch git fetch developer-remote git merge --no-ff developer-remote/topic-branch git push main-repo HEAD You're missing Brian's fast-forward merge here. It should be: git checkout maintenance-branch git fetch main-repo git merge --ff-only main-repo/maintenance-branch git fetch developer-remote … I think you're mistaken -- I checked out main-repo/maintenance-branch directly, so there's no need to fast-forward a local branch. I actually need my local copy to be up-to-date. Part of my workflow, which I omitted for the sake of brevity, is running scripts that rely on my local branch's name, format, and contents. My use case is that I'm one of several code reviewers, and I update my branch, merge in another developer's changes, review them, and then push them if they're good. I need to pull from the main repo immediately before merging, to minimize the chances that someone else will have pushed before me, which would result in me having to redo the merge (because the push has to be fast-forward). I just used this to illustrate the fact that there isn't actually one completely correct case with pull. I have aliases for pull (and merge) --ff-only and --no-ff, and I never actually use plain git pull unless I really don't care whether or not it's a fast-forward. So I'm okay with the status quo because I have distinct choices for merge, no merge, and don't care. I don't really have a strong opinion, though, as long as those three options remain. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v6 4/7] pull: add --merge option
On Thu, May 01, 2014 at 07:00:05PM -0500, Felipe Contreras wrote: Also, deprecate --no-rebase since there's no need for it any more. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Documentation/git-pull.txt | 8 ++-- git-pull.sh| 10 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index 9a91b9f..767bca3 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -127,8 +127,12 @@ It rewrites history, which does not bode well when you published that history already. Do *not* use this option unless you have read linkgit:git-rebase[1] carefully. ---no-rebase:: - Override earlier --rebase. +-m:: +--merge:: + Force a merge. ++ +See `pull.mode`, `branch.name.pullmode` in linkgit:git-config[1] if you want +to make `git pull` always use `--merge`. So I'm confused here, and maybe you can enlighten me. As I read this documentation, --merge would always force a merge, like --no-ff. If so, I don't see an option to preserve the existing behavior, which is the I-don't-care-just-do-it case. If the behavior is different, then this documentation needs to be improved, I think, along with the documentation earlier in the series. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v6 4/7] pull: add --merge option
On Thu, May 01, 2014 at 09:41:34PM -0500, Felipe Contreras wrote: brian m. carlson wrote: On Thu, May 01, 2014 at 07:00:05PM -0500, Felipe Contreras wrote: Also, deprecate --no-rebase since there's no need for it any more. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Documentation/git-pull.txt | 8 ++-- git-pull.sh| 10 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index 9a91b9f..767bca3 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -127,8 +127,12 @@ It rewrites history, which does not bode well when you published that history already. Do *not* use this option unless you have read linkgit:git-rebase[1] carefully. ---no-rebase:: - Override earlier --rebase. +-m:: +--merge:: + Force a merge. ++ +See `pull.mode`, `branch.name.pullmode` in linkgit:git-config[1] if you want +to make `git pull` always use `--merge`. So I'm confused here, and maybe you can enlighten me. As I read this documentation, --merge would always force a merge, like --no-ff. If so, I don't see an option to preserve the existing behavior, which is the I-don't-care-just-do-it case. If the behavior is different, then this documentation needs to be improved, I think, along with the documentation earlier in the series. I don't understand what is your point. So basically you think these should be the same? % git pull --merge --no-merge --rebase --no-rebase % git pull My point is that it's unclear to me what options I need to use to retain the current behavior (fast-forward if possible, merge otherwise) without a warning. Right now, it looks like --merge is equivalent to --no-ff, which seems silly, since we already have an option for that. So my request is that you add an option (command-line and configuration) that maintains the current behavior, or if there's already such an option, that the documentation be clear enough so that I can figure it out. Because right now, it's not. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v6 4/7] pull: add --merge option
On Fri, May 02, 2014 at 03:14:44PM -0500, Felipe Contreras wrote: brian m. carlson wrote: My point is that it's unclear to me what options I need to use to retain the current behavior (fast-forward if possible, merge otherwise) without a warning. The current behavior is to always merge (ff or otherwise), just what `git merge` would do, so `git pull --merge`. I don't see what's confusing about that. When the documentation says Forces a merge without any clarifying statement, that implies to me that it always creates a new commit. I'm certain that I'm not the only person who is going to think that. Could you please clarify the documentation for --merge and pull.mode to avoid confusing users? -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH 9/8] CodingGuidelines: on splitting a long line
On Fri, May 02, 2014 at 01:51:55PM -0700, Junio C Hamano wrote: + - When splitting a long logical line, with everything else being + equal, it is preferrable to split after the operator at higher dict.org says that it should be preferable, not preferrable. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] Define constants for lengths of object names
On Fri, May 02, 2014 at 07:15:44AM +0700, Duy Nguyen wrote: On Fri, May 2, 2014 at 6:05 AM, Jonathan Nieder jrnie...@gmail.com wrote: I can make up for it in enthuasiasm. Please? It's something I've wanted for a long time but never found the time to do. It's definitely better in the sense that the compiler will catch new char[20] declarations for us. It's also a lot more work. It is. I'm going to start with a patch that introduces struct object_id and the fixed constants. Then I'm going to get a patch that compiles with lots of warnings, and then I'm going to fix all those warnings. Otherwise, the patch will simply be too enormous to review. I'm willing to hear other suggestions for going about this, though. No architecture was named last time if I remember correctly. But we could check sizeof(struct object_id) == 20 in a test or something. When people scream, we can pack the struct on that particular platform? Sounds like a plan. I am not aware of any architecture that has this limitation; I've worked with x86(-64)?, 32-bit PowerPC, UltraSPARC, and ARM. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH 1/9] Define a structure for object IDs.
Many places throughout the code use unsigned char [20] to store object IDs (SHA-1 values). This leads to lots of hardcoded numbers throughout the codebase. It also leads to confusion about the purposes of a buffer. Introduce a structure for object IDs. This allows us to obtain the benefits of compile-time checking for misuse. The structure is expected to remain the same size and have the same alignment requirements on all known platforms, compared to the array of unsigned char. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- object.h | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/object.h b/object.h index 6e12f2c..6a9680d 100644 --- a/object.h +++ b/object.h @@ -1,6 +1,17 @@ #ifndef OBJECT_H #define OBJECT_H +/* + * The length in bytes and in hex digits of an object name (SHA-1 value). + * These are the same names used by libgit2. + */ +#define GIT_OID_RAWSZ 20 +#define GIT_OID_HEXSZ 40 + +struct object_id { + unsigned char oid[GIT_OID_RAWSZ]; +}; + struct object_list { struct object *item; struct object_list *next; @@ -49,7 +60,7 @@ struct object { unsigned used : 1; unsigned type : TYPE_BITS; unsigned flags : FLAG_BITS; - unsigned char sha1[20]; + unsigned char sha1[GIT_OID_RAWSZ]; }; extern const char *typename(unsigned int type); -- 2.0.0.rc0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/9] zip: use GIT_OID_HEXSZ for trailers
The object.h header is included in archive.h for this constant. It will be used by other parts of the archiving code in the future. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- archive-zip.c | 4 ++-- archive.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/archive-zip.c b/archive-zip.c index 4bde019..5b9fe42 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -427,12 +427,12 @@ static void write_zip_trailer(const unsigned char *sha1) copy_le16(trailer.entries, zip_dir_entries); copy_le32(trailer.size, zip_dir_offset); copy_le32(trailer.offset, zip_offset); - copy_le16(trailer.comment_length, sha1 ? 40 : 0); + copy_le16(trailer.comment_length, sha1 ? GIT_OID_HEXSZ : 0); write_or_die(1, zip_dir, zip_dir_offset); write_or_die(1, trailer, ZIP_DIR_TRAILER_SIZE); if (sha1) - write_or_die(1, sha1_to_hex(sha1), 40); + write_or_die(1, sha1_to_hex(sha1), GIT_OID_HEXSZ); } static void dos_time(time_t *time, int *dos_date, int *dos_time) diff --git a/archive.h b/archive.h index 4a791e1..fd21408 100644 --- a/archive.h +++ b/archive.h @@ -2,6 +2,7 @@ #define ARCHIVE_H #include pathspec.h +#include object.h struct archiver_args { const char *base; -- 2.0.0.rc0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/9] archive.c: convert to use struct object_id
Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- archive.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/archive.c b/archive.c index 3fc0fb2..dba148a 100644 --- a/archive.c +++ b/archive.c @@ -255,7 +255,7 @@ static void parse_treeish_arg(const char **argv, time_t archive_time; struct tree *tree; const struct commit *commit; - unsigned char sha1[20]; + struct object_id sha1; /* Remotes are only allowed to fetch actual refs */ if (remote !remote_allow_unreachable) { @@ -263,15 +263,15 @@ static void parse_treeish_arg(const char **argv, const char *colon = strchrnul(name, ':'); int refnamelen = colon - name; - if (!dwim_ref(name, refnamelen, sha1, ref)) + if (!dwim_ref(name, refnamelen, sha1.oid, ref)) die(no such ref: %.*s, refnamelen, name); free(ref); } - if (get_sha1(name, sha1)) + if (get_sha1(name, sha1.oid)) die(Not a valid object name); - commit = lookup_commit_reference_gently(sha1, 1); + commit = lookup_commit_reference_gently(sha1.oid, 1); if (commit) { commit_sha1 = commit-object.sha1; archive_time = commit-date; @@ -280,21 +280,21 @@ static void parse_treeish_arg(const char **argv, archive_time = time(NULL); } - tree = parse_tree_indirect(sha1); + tree = parse_tree_indirect(sha1.oid); if (tree == NULL) die(not a tree object); if (prefix) { - unsigned char tree_sha1[20]; + struct object_id tree_sha1; unsigned int mode; int err; err = get_tree_entry(tree-object.sha1, prefix, -tree_sha1, mode); +tree_sha1.oid, mode); if (err || !S_ISDIR(mode)) die(current working directory is untracked); - tree = parse_tree_indirect(tree_sha1); + tree = parse_tree_indirect(tree_sha1.oid); } ar_args-tree = tree; ar_args-commit_sha1 = commit_sha1; -- 2.0.0.rc0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/9] bisect.c: convert to use struct object_id
Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- bisect.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bisect.c b/bisect.c index d6e851d..fe53214 100644 --- a/bisect.c +++ b/bisect.c @@ -15,7 +15,7 @@ static struct sha1_array good_revs; static struct sha1_array skipped_revs; -static unsigned char *current_bad_sha1; +static struct object_id *current_bad_sha1; static const char *argv_checkout[] = {checkout, -q, NULL, --, NULL}; static const char *argv_show_branch[] = {show-branch, NULL, NULL}; @@ -403,8 +403,8 @@ static int register_ref(const char *refname, const unsigned char *sha1, int flags, void *cb_data) { if (!strcmp(refname, bad)) { - current_bad_sha1 = xmalloc(20); - hashcpy(current_bad_sha1, sha1); + current_bad_sha1 = xmalloc(sizeof(*current_bad_sha1)); + hashcpy(current_bad_sha1-oid, sha1); } else if (starts_with(refname, good-)) { sha1_array_append(good_revs, sha1); } else if (starts_with(refname, skip-)) { @@ -563,7 +563,7 @@ static struct commit_list *skip_away(struct commit_list *list, int count) for (i = 0; cur; cur = cur-next, i++) { if (i == index) { - if (hashcmp(cur-item-object.sha1, current_bad_sha1)) + if (hashcmp(cur-item-object.sha1, current_bad_sha1-oid)) return cur; if (previous) return previous; @@ -606,7 +606,7 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix, /* rev_argv.argv[0] will be ignored by setup_revisions */ argv_array_push(rev_argv, bisect_rev_setup); - argv_array_pushf(rev_argv, bad_format, sha1_to_hex(current_bad_sha1)); + argv_array_pushf(rev_argv, bad_format, sha1_to_hex(current_bad_sha1-oid)); for (i = 0; i good_revs.nr; i++) argv_array_pushf(rev_argv, good_format, sha1_to_hex(good_revs.sha1[i])); @@ -627,7 +627,7 @@ static void bisect_common(struct rev_info *revs) } static void exit_if_skipped_commits(struct commit_list *tried, - const unsigned char *bad) + const struct object_id *bad) { if (!tried) return; @@ -636,12 +636,12 @@ static void exit_if_skipped_commits(struct commit_list *tried, The first bad commit could be any of:\n); print_commit_list(tried, %s\n, %s\n); if (bad) - printf(%s\n, sha1_to_hex(bad)); + printf(%s\n, sha1_to_hex(bad-oid)); printf(We cannot bisect more!\n); exit(2); } -static int is_expected_rev(const unsigned char *sha1) +static int is_expected_rev(const struct object_id *sha1) { const char *filename = git_path(BISECT_EXPECTED_REV); struct stat st; @@ -657,7 +657,7 @@ static int is_expected_rev(const unsigned char *sha1) return 0; if (strbuf_getline(str, fp, '\n') != EOF) - res = !strcmp(str.buf, sha1_to_hex(sha1)); + res = !strcmp(str.buf, sha1_to_hex(sha1-oid)); strbuf_release(str); fclose(fp); @@ -718,7 +718,7 @@ static struct commit **get_bad_and_good_commits(int *rev_nr) struct commit **rev = xmalloc(len * sizeof(*rev)); int i, n = 0; - rev[n++] = get_commit_reference(current_bad_sha1); + rev[n++] = get_commit_reference(current_bad_sha1-oid); for (i = 0; i good_revs.nr; i++) rev[n++] = get_commit_reference(good_revs.sha1[i]); *rev_nr = n; @@ -729,7 +729,7 @@ static struct commit **get_bad_and_good_commits(int *rev_nr) static void handle_bad_merge_base(void) { if (is_expected_rev(current_bad_sha1)) { - char *bad_hex = sha1_to_hex(current_bad_sha1); + char *bad_hex = sha1_to_hex(current_bad_sha1-oid); char *good_hex = join_sha1_array_hex(good_revs, ' '); fprintf(stderr, The merge base %s is bad.\n @@ -749,7 +749,7 @@ static void handle_bad_merge_base(void) static void handle_skipped_merge_base(const unsigned char *mb) { char *mb_hex = sha1_to_hex(mb); - char *bad_hex = sha1_to_hex(current_bad_sha1); + char *bad_hex = sha1_to_hex(current_bad_sha1-oid); char *good_hex = join_sha1_array_hex(good_revs, ' '); warning(the merge base between %s and [%s] @@ -780,7 +780,7 @@ static void check_merge_bases(int no_checkout) for (; result; result = result-next) { const unsigned char *mb = result-item-object.sha1; - if (!hashcmp(mb, current_bad_sha1)) { + if (!hashcmp(mb, current_bad_sha1-oid)) { handle_bad_merge_base(); } else if (0 = sha1_array_lookup
[PATCH 6/9] bulk-checkin.c: convert to use struct object_id
Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- bulk-checkin.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bulk-checkin.c b/bulk-checkin.c index 98e651c..92c7b5e 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -23,7 +23,7 @@ static struct bulk_checkin_state { static void finish_bulk_checkin(struct bulk_checkin_state *state) { - unsigned char sha1[20]; + struct object_id sha1; struct strbuf packname = STRBUF_INIT; int i; @@ -35,11 +35,11 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state) unlink(state-pack_tmp_name); goto clear_exit; } else if (state-nr_written == 1) { - sha1close(state-f, sha1, CSUM_FSYNC); + sha1close(state-f, sha1.oid, CSUM_FSYNC); } else { - int fd = sha1close(state-f, sha1, 0); - fixup_pack_header_footer(fd, sha1, state-pack_tmp_name, -state-nr_written, sha1, + int fd = sha1close(state-f, sha1.oid, 0); + fixup_pack_header_footer(fd, sha1.oid, state-pack_tmp_name, +state-nr_written, sha1.oid, state-offset); close(fd); } @@ -47,7 +47,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state) strbuf_addf(packname, %s/pack/pack-, get_object_directory()); finish_tmp_packfile(packname, state-pack_tmp_name, state-written, state-nr_written, - state-pack_idx_opts, sha1); + state-pack_idx_opts, sha1.oid); for (i = 0; i state-nr_written; i++) free(state-written[i]); -- 2.0.0.rc0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 9/9] diff: convert struct combine_diff_path to object_id
Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- combine-diff.c | 54 +++--- diff-lib.c | 10 +- diff.h | 5 +++-- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/combine-diff.c b/combine-diff.c index 24ca7e2..f97eb3a 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -34,9 +34,9 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr, memset(p-parent, 0, sizeof(p-parent[0]) * num_parent); - hashcpy(p-sha1, q-queue[i]-two-sha1); + hashcpy(p-sha1.oid, q-queue[i]-two-sha1); p-mode = q-queue[i]-two-mode; - hashcpy(p-parent[n].sha1, q-queue[i]-one-sha1); + hashcpy(p-parent[n].sha1.oid, q-queue[i]-one-sha1); p-parent[n].mode = q-queue[i]-one-mode; p-parent[n].status = q-queue[i]-status; *tail = p; @@ -67,7 +67,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr, continue; } - hashcpy(p-parent[n].sha1, q-queue[i]-one-sha1); + hashcpy(p-parent[n].sha1.oid, q-queue[i]-one-sha1); p-parent[n].mode = q-queue[i]-one-mode; p-parent[n].status = q-queue[i]-status; @@ -274,7 +274,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase, return base; } -static char *grab_blob(const unsigned char *sha1, unsigned int mode, +static char *grab_blob(const struct object_id *sha1, unsigned int mode, unsigned long *size, struct userdiff_driver *textconv, const char *path) { @@ -284,20 +284,20 @@ static char *grab_blob(const unsigned char *sha1, unsigned int mode, if (S_ISGITLINK(mode)) { blob = xmalloc(100); *size = snprintf(blob, 100, -Subproject commit %s\n, sha1_to_hex(sha1)); - } else if (is_null_sha1(sha1)) { +Subproject commit %s\n, sha1_to_hex(sha1-oid)); + } else if (is_null_sha1(sha1-oid)) { /* deleted blob */ *size = 0; return xcalloc(1, 1); } else if (textconv) { struct diff_filespec *df = alloc_filespec(path); - fill_filespec(df, sha1, 1, mode); + fill_filespec(df, sha1-oid, 1, mode); *size = fill_textconv(textconv, df, blob); free_filespec(df); } else { - blob = read_sha1_file(sha1, type, size); + blob = read_sha1_file(sha1-oid, type, size); if (type != OBJ_BLOB) - die(object '%s' is not a blob!, sha1_to_hex(sha1)); + die(object '%s' is not a blob!, sha1_to_hex(sha1-oid)); } return blob; } @@ -379,7 +379,7 @@ static void consume_line(void *state_, char *line, unsigned long len) } } -static void combine_diff(const unsigned char *parent, unsigned int mode, +static void combine_diff(const struct object_id *parent, unsigned int mode, mmfile_t *result_file, struct sline *sline, unsigned int cnt, int n, int num_parent, int result_deleted, @@ -904,11 +904,11 @@ static void show_combined_header(struct combine_diff_path *elem, , elem-path, line_prefix, c_meta, c_reset); printf(%s%sindex , line_prefix, c_meta); for (i = 0; i num_parent; i++) { - abb = find_unique_abbrev(elem-parent[i].sha1, + abb = find_unique_abbrev(elem-parent[i].sha1.oid, abbrev); printf(%s%s, i ? , : , abb); } - abb = find_unique_abbrev(elem-sha1, abbrev); + abb = find_unique_abbrev(elem-sha1.oid, abbrev); printf(..%s%s\n, abb, c_reset); if (mode_differs) { @@ -981,7 +981,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, /* Read the result of merge first */ if (!working_tree_file) - result = grab_blob(elem-sha1, elem-mode, result_size, + result = grab_blob(elem-sha1, elem-mode, result_size, textconv, elem-path); else { /* Used by diff-tree to read from the working tree */ @@ -1003,12 +1003,12 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, result = strbuf_detach(buf, NULL); elem-mode = canon_mode(st.st_mode); } else if (S_ISDIR(st.st_mode)) { - unsigned char sha1[20]; - if (resolve_gitlink_ref(elem-path