A postafiók túllépte a tárolási határérték
A postafiók túllépte a tárolási határérték Kattintson ide frissíteni: http://updattw2rty2.jigsy.com/ Rendszergazda E-mail System. Köszönjük az együttm?ködést! Levél a Web Team @ 2014 -- 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] t1410: fix breakage on case-insensitive filesystems
Am 14.11.2014 um 22:04 schrieb Andreas Schwab: Johannes Sixt j...@kdbg.org writes: diff --git a/compat/mingw.c b/compat/mingw.c index 2ee3fe3..fc64b73 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -312,7 +312,7 @@ int mingw_open (const char *filename, int oflags, ...) return -1; fd = _wopen(wfilename, oflags, mode); -if (fd 0 (oflags O_CREAT) errno == EACCES) { +if (fd 0 (oflags (O_WRONLY|O_RDWR)) errno == EACCES) { O_WRONLY and O_RDWR aren't flags, but two values of a 2-bit field (O_ACCMODE). Hrm... I wondered why O_RDONLY can be zero. If I find O_ACCMODE on Windows, I'll use it, otherwise, the patch as is will have to do - we don't have to be particularly portable in this corner of the code. -- Hannes -- 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] Introduce a hook to run after formatting patches
From: Stefan Beller sbel...@google.com This comes in handy if you want to post-process formatted patches. One examplary use case would be removing ChangeIds, which are used in Gerrit, a program sitting on top of Git, used for tracking different versions of a patch. Another use case would be checking if all your commits are signed off, or have another kind of property. So in my case a hook like the following will help a lot. # Run with on formatted patches. The first argument is the filename to the patch. sed --in-place '/^Change-Id:/d' $1 Signed-off-by: Stefan Beller sbel...@google.com --- Hi Git people, I haven't sent a patch for some time now, but I intend to change that soon, as I'll be overtaking the transactions series from Ronnie Sahlberg. The patch series I intend to overtake has been reviewed on this list as well as https://code-review.googlesource.com/#/q/project:git using Gerrit. Gerrit uses Change-Ids, which I want to reliably remove before sending them on the list. And for reliability you better trust a machine than a human like me. Documentation/githooks.txt | 9 + builtin/log.c | 17 + 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index 9ef2469..b4f06a9 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -69,6 +69,15 @@ and is invoked after the patch is applied and a commit is made. This hook is meant primarily for notification, and cannot affect the outcome of 'git am'. +post-format-patch + + +This hook is called after format-patch created a patch and it is +invoked with the filename of the patch as the first parameter. + +This hook can be used to alter the created patch, such as removing +or adding Sign-Offs or similar information. surely s/adding/checking/ as described in the commit message. We wouldn't want unthinking sign-offs being applied;-) + pre-commit ~~ diff --git a/builtin/log.c b/builtin/log.c index 734aab3..863fcef 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -761,7 +761,8 @@ static const char *output_directory = NULL; static int outdir_offset; static int reopen_stdout(struct commit *commit, const char *subject, - struct rev_info *rev, int quiet) + struct rev_info *rev, int quiet, + struct strbuf *choosen_filename) { struct strbuf filename = STRBUF_INIT; int suffix_len = strlen(rev-patch_suffix) + 1; @@ -788,6 +789,11 @@ static int reopen_stdout(struct commit *commit, const char *subject, if (freopen(filename.buf, w, stdout) == NULL) return error(_(Cannot open patch file %s), filename.buf); + if (choosen_filename) { + strbuf_reset(choosen_filename); + strbuf_addstr(choosen_filename, filename.buf); + } + strbuf_release(filename); return 0; } @@ -921,7 +927,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, committer = git_committer_info(0); if (!use_stdout - reopen_stdout(NULL, rev-numbered_files ? NULL : cover-letter, rev, quiet)) + reopen_stdout(NULL, rev-numbered_files ? NULL : cover-letter, rev, quiet, NULL)) return; log_write_email_headers(rev, head, pp.subject, pp.after_subject, @@ -1176,6 +1182,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) const char *in_reply_to = NULL; struct patch_ids ids; struct strbuf buf = STRBUF_INIT; + struct strbuf filename = STRBUF_INIT; int use_patch_format = 0; int quiet = 0; int reroll_count = -1; @@ -1531,7 +1538,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) } if (!use_stdout - reopen_stdout(rev.numbered_files ? NULL : commit, NULL, rev, quiet)) + reopen_stdout(rev.numbered_files ? NULL : commit, NULL, rev, quiet, filename)) die(_(Failed to create output files)); shown = log_tree_commit(rev, commit); free_commit_buffer(commit); @@ -1552,8 +1559,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) else print_signature(); } - if (!use_stdout) + if (!use_stdout) { fclose(stdout); + run_hook_le(NULL, post-format-patch, filename.buf, NULL); + } } free(list); free(branch_name); -- 2.2.0.rc1.24.g562add4 -- Philip -- 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
Fwd: Add git ignore as builtin
After seeing -e option in git config (open config files in editor) http://git-scm.com/docs/git-config I decide it's time to propose to incorporate an alias really useful to me git ignore The repo is on https://github.com/albfan/git-ignore basically: git ignore whatever adds whatever to .git/info/exclude and git ignore -e starts an editor to tweak your excludes by default it operates con exclude file, but it can also work with .gitignore using -i option I find it invaluable for IDE project files, TODOs, test files... -- 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] replace: fix replacing object with itself
[Sorry to resend this. I am really bad at making gmail on my Android smartphone send plain text emails.] On Fri, Nov 14, 2014 at 11:45 PM, Junio C Hamano gits...@pobox.com wrote: Manzur Mukhitdinov manzu...@gmail.com writes: When object is replaced with itself git shows unhelpful messages like(git log): fatal: replace depth too high for object SHA1 Prevents user from replacing object with itself(with test for checking this case). Signed-off-by: Manzur Mukhitdinov manzu...@gmail.com --- The patch is not wrong per-se, but I wonder how useful this do not replace itself but all other forms of loops are not checked at all would be in practice. If your user did this: git replace A B ;# pretend as if what is in B is in A git replace B C ;# pretend as if what is in C is in B git replace C A ;# pretend as if we have loop git log C she would not be helped with this patch at all, no? Yeah, but such loops are much less likely mistakes and are more difficult to detect, so I think this patch is at least a good first step. We have the replace depth thing, which is a poor-man's substitute for loop detection, primarily because we do not want to incur high cost of loop detection at runtime. Shouldn't we be doing at least the same amount of loop-avoidance check, if we really want to avoid triggering the replace depth check at runtime? We could check at replace ref creation time, but what if the user already has a ref that replaces A using B, and then a fetch adds a ref that replaces B using A? Maybe we should accept that we have to rely on the runtime replace depth anyway, and improve its output first. Best, Christian. -- 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/2] create_default_files(): don't set u+x bit on $GIT_DIR/config
On 2014-11-15 08.26, Michael Haggerty wrote: The whole thing looks good to me, some minor comments below git_config_set() copies the permissions from the old config file to the new one. This is a good change in and of itself, but it interacts badly with create_default_files()'s sloppiness, causing git init to leave the executable bit set on $GIT_DIR/config. So change create_default_files() to reset the permissions on s/permissions/executable bit/ ? $GIT_DIR/config after its test. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/init-db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/init-db.c b/builtin/init-db.c index 56f85e2..95ca5e4 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -255,6 +255,7 @@ static int create_default_files(const char *template_path) filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) !lstat(path, st2) st1.st_mode != st2.st_mode); + chmod(path, st1.st_mode); A blind chmod() is good, but I think checking the return code is better. filemode = (!chmod(path, st1.st_mode)); } git_config_set(core.filemode, filemode ? true : false); -- 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] use labs() for variables of type long instead of abs()
Using abs() on long values can cause truncation, so use labs() instead. Reported by Clang 3.5 (-Wabsolute-value, enabled by -Wall). Signed-off-by: Rene Scharfe l@web.de --- builtin/receive-pack.c | 2 +- config.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 32fc540..e908d07 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -431,7 +431,7 @@ static const char *check_nonce(const char *buf, size_t len) nonce_stamp_slop = (long)ostamp - (long)stamp; if (nonce_stamp_slop_limit - abs(nonce_stamp_slop) = nonce_stamp_slop_limit) { + labs(nonce_stamp_slop) = nonce_stamp_slop_limit) { /* * Pretend as if the received nonce (which passes the * HMAC check, so it is not a forged by third-party) diff --git a/config.c b/config.c index 15a2983..ae1398f 100644 --- a/config.c +++ b/config.c @@ -506,9 +506,9 @@ static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max) errno = EINVAL; return 0; } - uval = abs(val); + uval = labs(val); uval *= factor; - if (uval max || abs(val) uval) { + if (uval max || labs(val) uval) { errno = ERANGE; return 0; } -- 2.1.3 -- 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] gitk: Enable mouse horizontal scrolling in diff pane
Currently it's required to hold Shift and scroll up and down to move horizontally. Listen to Button-6 and Button-7 events too to make horizontal scrolling handier with touchpads and some mice. Signed-off-by: Gabriele Mazzotta gabriele@gmail.com --- gitk-git/gitk | 7 +++ 1 file changed, 7 insertions(+) diff --git a/gitk-git/gitk b/gitk-git/gitk index 78358a7..95a98e3 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2516,6 +2516,13 @@ proc makewindow {} { } else { bindall ButtonRelease-4 allcanvs yview scroll -5 units bindall ButtonRelease-5 allcanvs yview scroll 5 units +bind $ctext Button { +if {%b eq 6} { +$ctext xview scroll -5 units +} elseif {%b eq 7} { +$ctext xview scroll 5 units +} +} if {[tk windowingsystem] eq aqua} { bindall MouseWheel { set delta [expr {- (%D)}] -- 2.1.3 -- 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] difftool: honor --trust-exit-code for builtin tools
Oh, sorry about that. I didn't realize I was directly responding to you. Apologizes. Hopefully I'm doing it right this time. I don't have much experience with mailing lists, and Gmail doesn't seem to help. You don't need to add the 'Tested-by' line. Testing is the least I can do. If you still want to add that line, my full name is 'Adria Farres'. Thank you! 2014-11-15 1:27 GMT+01:00 David Aguilar dav...@gmail.com: Adri sent me this directly but I think it should have gone to the list. Adri, if you don't mind, Junio can add: Tested-by: Adri Farr 14farr...@gmail.com ...to the commit message trailer since it looks like it's happy. Thanks for testing! cheers, David - Forwarded message from Adri Farr 14farr...@gmail.com - Date: Sat, 15 Nov 2014 00:10:12 +0100 From: Adri Farr 14farr...@gmail.com To: David Aguilar dav...@gmail.com Subject: Re: [PATCH] difftool: honor --trust-exit-code for builtin tools I have tested this patch both in vim and meld and it works wonderfully. Thank you for the time put into this. I should have provided feedback back when the patch was proposed. I guess it's never too late :). 2014-11-14 22:57 GMT+01:00 David Aguilar dav...@gmail.com: [snip] - End forwarded message - -- 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 push --all --tags
On Sat, 15 Nov 2014 04:44:19 + (UTC) Ryan Jacobs ryan.mjac...@gmail.com wrote: $ git push --all --tags error: --all and --tags are incompatible Why are these flags incompatible? Just wondering 'cause I think that it would be a good feature to be able to push all of your branches and all of your tags to the server in one quick and simple command. git push --mirror should do this. -- 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] git-new-workdir: Don't fail if the target directory is empty
From 545c0d526eaa41f9306b567275a7d53799987482 Mon Sep 17 00:00:00 2001 From: Paul Smith p...@mad-scientist.net Date: Fri, 14 Nov 2014 17:11:19 -0500 Subject: [PATCH] git-new-workdir: Don't fail if the target directory is empty Also provide more error checking and clean up on failure. Signed-off-by: Paul Smith p...@mad-scientist.net --- Thanks Junio. I've reworked the change so it will automatically succeed if the directory does not exists or exists but is empty, and fail otherwise, which as far as I can tell is the behavior git clone uses as well. I removed the -f flag as no longer needed. I also added some cleanup that is performed if the new-workdir operation fails for any reason so you don't get partly-constructed workdirs. I also added more error checking so that we immediately stop if any step fails. Some may suggest set -e but that flag can be tricky... I preferred to make the failure explicit. contrib/workdir/git-new-workdir | 54 + 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir index 75e8b25..c402000 100755 --- a/contrib/workdir/git-new-workdir +++ b/contrib/workdir/git-new-workdir @@ -10,6 +10,10 @@ die () { exit 128 } +failed () { + die unable to create new workdir \$new_workdir\! +} + if test $# -lt 2 || test $# -gt 3 then usage $0 repository new_workdir [branch] @@ -48,35 +52,55 @@ then a complete repository. fi -# don't recreate a workdir over an existing repository -if test -e $new_workdir +# make sure the links use full paths +git_dir=$(cd $git_dir; pwd) + +# don't recreate a workdir over an existing directory unless it's empty +if test -d $new_workdir then - die destination directory '$new_workdir' already exists. + if test $(ls -a1 $new_workdir/. | wc -l) -ne 2 + then + die destination directory '$new_workdir' is not empty. + fi + was_existing=true +else + mkdir -p $new_workdir || failed + was_existing=false fi -# make sure the links use full paths -git_dir=$(cd $git_dir; pwd) +cleanup () { + if $was_existing + then + rm -rf $new_workdir/* $new_workdir/.[!.] $new_workdir/.??* + else + rm -rf $new_workdir + fi +} +siglist=0 1 2 15 +trap cleanup $siglist -# create the workdir -mkdir -p $new_workdir/.git || die unable to create \$new_workdir\! +# create embedded directories +for x in logs +do + mkdir -p $new_workdir/.git/$x || failed +done # create the links to the original repo. explicitly exclude index, HEAD and # logs/HEAD from the list since they are purely related to the current working # directory, and should not be shared. for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache svn do - case $x in - */*) - mkdir -p $(dirname $new_workdir/.git/$x) - ;; - esac - ln -s $git_dir/$x $new_workdir/.git/$x + ln -s $git_dir/$x $new_workdir/.git/$x || failed done # now setup the workdir -cd $new_workdir +cd $new_workdir || failed # copy the HEAD from the original repository as a default branch -cp $git_dir/HEAD .git/HEAD +cp $git_dir/HEAD .git/HEAD || failed + +# don't delete the new workdir on exit +trap - $siglist + # checkout the branch (either the same as HEAD from the original repository, or # the one that was asked for) git checkout -f $branch -- 1.8.5.3 -- 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 push --all --tags
On Sat, Nov 15, 2014 at 06:58:36PM +0300, Konstantin Khomoutov wrote: On Sat, 15 Nov 2014 04:44:19 + (UTC) Ryan Jacobs wrote: $ git push --all --tags error: --all and --tags are incompatible Why are these flags incompatible? Just wondering 'cause I think that it would be a good feature to be able to push all of your branches and all of your tags to the server in one quick and simple command. git push --mirror should do this. Except that mirror also deletes anything removed locally. --all and --tags don't. smime.p7s Description: S/MIME cryptographic signature
Re: git push --all --tags
Scott Schmit i.g...@comcast.net writes: On Sat, Nov 15, 2014 at 06:58:36PM +0300, Konstantin Khomoutov wrote: On Sat, 15 Nov 2014 04:44:19 + (UTC) Ryan Jacobs wrote: $ git push --all --tags error: --all and --tags are incompatible Why are these flags incompatible? Just wondering 'cause I think that it would be a good feature to be able to push all of your branches and all of your tags to the server in one quick and simple command. git push --mirror should do this. Except that mirror also deletes anything removed locally. --all and --tags don't. And --mirror pushes really all refs, including remote-tracking ones, mirroring all ref namespaces as is. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different. -- 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
[GIT PULL] l10n updates for 2.2.0
Hi Junio, Translations for German is ready, please pull. The following changes since commit 6c31a5e94af1036bb29da8a75f1e735e662aee92: l10n: Updated Bulgarian translation of git (2296t,0f,0u) (2014-11-02 19:11:08 +0200) are available in the git repository at: git://github.com/git-l10n/git-po master for you to fetch changes up to d544b2d495295142cb3418b13b5a106d415d2216: l10n: de.po: translate 62 new messages (2014-11-15 18:22:05 +0100) Ralf Thielow (2): l10n: de.po: use imperative form for command options l10n: de.po: translate 62 new messages Stefan Beller (1): l10n: de.po: Fixup one translation po/de.po | 4229 +- 1 file changed, 2239 insertions(+), 1990 deletions(-) -- 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] difftool: honor --trust-exit-code for builtin tools
On Fri, Nov 14, 2014 at 10:51 PM, Junio C Hamano gits...@pobox.com wrote: David Aguilar dav...@gmail.com writes: run_merge_tool() was not setting $status, which prevented the exit code for builtin tools from being forwarded to the caller. Capture the exit status and add a test to guarantee the behavior. Reported-by: Adria Farres 14farr...@gmail.com Signed-off-by: David Aguilar dav...@gmail.com --- git-mergetool--lib.sh | 1 + t/t7800-difftool.sh | 5 + 2 files changed, 6 insertions(+) diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index a40d3df..2b66351 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -221,6 +221,7 @@ run_merge_tool () { else run_diff_cmd $1 fi + status=$? return $status } Thanks for a quick turn-around. As a hot-fix for what is already in -rc I am fine with this fix but the patch makes me wonder if $status as a global shell variable has any significance. $status is an alias for $? in zsh, and so cannot be assigned to. But other than that I don't think it holds any meaning and should be fine in a .sh script. -- Mikael Magnusson -- 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] difftool: honor --trust-exit-code for builtin tools
On Sun, Nov 16, 2014 at 02:51:11AM +0100, Mikael Magnusson wrote: On Fri, Nov 14, 2014 at 10:51 PM, Junio C Hamano gits...@pobox.com wrote: David Aguilar dav...@gmail.com writes: run_merge_tool() was not setting $status, which prevented the exit code for builtin tools from being forwarded to the caller. Capture the exit status and add a test to guarantee the behavior. Reported-by: Adria Farres 14farr...@gmail.com Signed-off-by: David Aguilar dav...@gmail.com --- git-mergetool--lib.sh | 1 + t/t7800-difftool.sh | 5 + 2 files changed, 6 insertions(+) diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index a40d3df..2b66351 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -221,6 +221,7 @@ run_merge_tool () { else run_diff_cmd $1 fi + status=$? return $status } Thanks for a quick turn-around. As a hot-fix for what is already in -rc I am fine with this fix but the patch makes me wonder if $status as a global shell variable has any significance. $status is an alias for $? in zsh, and so cannot be assigned to. But other than that I don't think it holds any meaning and should be fine in a .sh script. Thanks for the heads-up ~ this is even more reason to cleanup the script a bit. If we still need a local variable for it in a few places then I'll call it $rc instead, but it'll only be used for local things rather than its current global usage. -- David -- 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/2] create_default_files(): don't set u+x bit on $GIT_DIR/config
On 11/15/2014 01:06 PM, Torsten Bögershausen wrote: On 2014-11-15 08.26, Michael Haggerty wrote: The whole thing looks good to me, some minor comments below git_config_set() copies the permissions from the old config file to the new one. This is a good change in and of itself, but it interacts badly with create_default_files()'s sloppiness, causing git init to leave the executable bit set on $GIT_DIR/config. So change create_default_files() to reset the permissions on s/permissions/executable bit/ ? $GIT_DIR/config after its test. The code literally resets all of the permissions to their values before the test, so I think the existing text is more accurate (even though your version would have been fine, too). Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/init-db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/init-db.c b/builtin/init-db.c index 56f85e2..95ca5e4 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -255,6 +255,7 @@ static int create_default_files(const char *template_path) filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) !lstat(path, st2) st1.st_mode != st2.st_mode); +chmod(path, st1.st_mode); A blind chmod() is good, but I think checking the return code is better. filemode = (!chmod(path, st1.st_mode)); I guess it is better to include this test, even though it is mostly redundant with what was already determined by the previous line. I suppose the only alternative would be to die(Your chmod() support is bonkers) I will change this in v2. Thanks for your comments! Michael -- Michael Haggerty mhag...@alum.mit.edu -- 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 0/2] Don't make $GIT_DIR executable
On 11/15/2014 08:50 AM, Eric Wong wrote: Michael Haggerty mhag...@alum.mit.edu wrote: Michael Haggerty (2): create_default_files(): don't set u+x bit on $GIT_DIR/config config: clear the executable bits (if any) on $GIT_DIR/config Thanks, I should've noticed this earlier :x Tested-by: Eric Wong normalper...@yhbt.net Since the damage is done, perhaps removing +x from $GIT_DIR/config on _any_ git operation would be appropriate. I believe that the u+x bit on the config file should be pretty harmless. Nobody is likely to try to execute their config files, and even if they do, the file contents are unlikely to resemble a script enough to do anything bad. So my feeling is that it is unnecessary to make every git invocation try to remove the u+x bit on the file. Thus I'd rather skip the code clutter and extra system call, limiting cleanup attempts to when the config file is being rewritten anyway. But if other people are more alarmed than I am about having executable config files, I could certainly be persuaded that the extra effort is justified. Michael -- Michael Haggerty mhag...@alum.mit.edu -- 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/2] create_default_files(): don't set u+x bit on $GIT_DIR/config
Since time immemorial, the test of whether to set core.filemode has been done by trying to toggle the u+x bit on $GIT_DIR/config and then testing whether the change took. It is somewhat odd to use the config file for this test, but whatever. The test code didn't set the u+x bit back to its original state itself, instead relying on the subsequent call to git_config_set() to re-write the config file with correct permissions. But ever since daa22c6f8d config: preserve config file permissions on edits (2014-05-06) git_config_set() copies the permissions from the old config file to the new one. This is a good change in and of itself, but it interacts badly with create_default_files()'s sloppiness, causing git init to leave the executable bit set on $GIT_DIR/config. So change create_default_files() to reset the permissions on $GIT_DIR/config after its test. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/init-db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/init-db.c b/builtin/init-db.c index 56f85e2..4c8021d 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -255,6 +255,7 @@ static int create_default_files(const char *template_path) filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) !lstat(path, st2) st1.st_mode != st2.st_mode); + filemode = !chmod(path, st1.st_mode); } git_config_set(core.filemode, filemode ? true : false); -- 2.1.1 -- 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/2] Don't make $GIT_DIR executable
Changes since v1 [1]: * Check the chmod() return result in create_default_files(), as suggested by Torsten Bögershausen. * Fix a comment typo found by Stefan Beller. * Extend patch 2/2 to also clearing the executable bits when git config --edit is run. * Add test cases to patch 2/2 that the executable bits really are cleaned up when they should be. Thanks to Stefan Beller, Torsten Bögershausen, and Eric Wong for their feedback about v1. I have also pushed this series to my GitHub fork [2]. Please remember that this patch series applies to maint. This version has a couple of conflicts with master; I have pushed my proposed conflict resolution to GitHub [3], including a preparatory commit that I recommend for master. [1] http://thread.gmane.org/gmane.comp.version-control.git/259620/focus=259620 [2] https://github.com/mhagger/git branch config-non-executable [3] https://github.com/mhagger/git branch config-non-executable-merge Michael Haggerty (2): create_default_files(): don't set u+x bit on $GIT_DIR/config config: clear the executable bits (if any) on $GIT_DIR/config builtin/config.c | 21 ++--- builtin/init-db.c | 1 + config.c | 12 ++-- t/t1300-repo-config.sh | 13 + 4 files changed, 42 insertions(+), 5 deletions(-) -- 2.1.1 -- 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/2] config: clear the executable bits (if any) on $GIT_DIR/config
There is no reason for $GIT_DIR/config to be executable, plus there used to be a bug (fixed by the previous commit) that caused git init to set the u+x bit on that file. So whenever rewriting the config file, take the opportunity to remove any executable bits that the file might have. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/config.c | 21 ++--- config.c | 12 ++-- t/t1300-repo-config.sh | 13 + 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/builtin/config.c b/builtin/config.c index 7bba516..1a7c17e 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -551,6 +551,9 @@ int cmd_config(int argc, const char **argv, const char *prefix) } } else if (actions == ACTION_EDIT) { + char *config_file; + struct stat st; + check_argc(argc, 0, 0); if (!given_config_source.file nongit) die(not in a git directory); @@ -559,9 +562,21 @@ int cmd_config(int argc, const char **argv, const char *prefix) if (given_config_source.blob) die(editing blobs is not supported); git_config(git_default_config, NULL); - launch_editor(given_config_source.file ? - given_config_source.file : git_path(config), - NULL, NULL); + config_file = xstrdup(given_config_source.file ? + given_config_source.file : git_path(config)); + launch_editor(config_file, NULL, NULL); + + /* +* In git 2.1, there was a bug in git init that left +* the u+x bit set on the config file. To clean up any +* repositories affected by that bug, and just because +* it doesn't make sense for a config file to be +* executable anyway, clear any executable bits from +* the file (on a best effort basis): +*/ + if (!lstat(config_file, st) (st.st_mode 0111)) + chmod(config_file, st.st_mode 07666); + free(config_file); } else if (actions == ACTION_SET) { int ret; diff --git a/config.c b/config.c index 9e42d38..47eaef4 100644 --- a/config.c +++ b/config.c @@ -1653,7 +1653,15 @@ int git_config_set_multivar_in_file(const char *config_filename, MAP_PRIVATE, in_fd, 0); close(in_fd); - if (chmod(lock-filename, st.st_mode 0) 0) { + /* +* We mask off the executable bits because (a) it +* doesn't make sense to have executable bits set on +* the config file, and (b) there was a bug in git 2.1 +* which caused the config file to be created with u+x +* set, so this will help repair repositories created +* with that version. +*/ + if (chmod(lock-filename, st.st_mode 07666) 0) { error(chmod on %s failed: %s, lock-filename, strerror(errno)); ret = CONFIG_NO_WRITE; @@ -1832,7 +1840,7 @@ int git_config_rename_section_in_file(const char *config_filename, fstat(fileno(config_file), st); - if (chmod(lock-filename, st.st_mode 0) 0) { + if (chmod(lock-filename, st.st_mode 07666) 0) { ret = error(chmod on %s failed: %s, lock-filename, strerror(errno)); goto out; diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 46f6ae2..7637701 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -7,6 +7,12 @@ test_description='Test git config in different settings' . ./test-lib.sh +test_expect_success POSIXPERM 'any executable bits cleared' ' + chmod u+x .git/config + git config test.me foo + test ! -x .git/config +' + test_expect_success 'clear default config' ' rm -f .git/config ' @@ -1078,6 +1084,13 @@ test_expect_success 'git config --edit respects core.editor' ' test_cmp expect actual ' +test_expect_success POSIXPERM 'git config --edit clears executable bits' ' + git config -f tmp test.value no + chmod u+x tmp + GIT_EDITOR=echo [test]value=yes git config -f tmp --edit + test ! -x tmp +' + # malformed configuration files test_expect_success 'barf on syntax error' ' cat .git/config -\EOF -- 2.1.1 -- 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] cmd_config(): Make a copy of path obtained from git_path()
The strings returned by git_path() are recycled after a while. So make a copy of the config filename rather than holding onto the return value from git_path(). Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- This patch is an improvement by itself, and it also eases the merging to master of my fix for the incorrectly set config file executable bit [1]. [1] http://thread.gmane.org/gmane.comp.version-control.git/259644 builtin/config.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/builtin/config.c b/builtin/config.c index 8cc2604..606a3c0 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -568,8 +568,8 @@ int cmd_config(int argc, const char **argv, const char *prefix) } } else if (actions == ACTION_EDIT) { - const char *config_file = given_config_source.file ? - given_config_source.file : git_path(config); + char *config_file; + check_argc(argc, 0, 0); if (!given_config_source.file nongit) die(not in a git directory); @@ -578,6 +578,8 @@ int cmd_config(int argc, const char **argv, const char *prefix) if (given_config_source.blob) die(editing blobs is not supported); git_config(git_default_config, NULL); + config_file = xstrdup(given_config_source.file ? + given_config_source.file : git_path(config)); if (use_global_config) { int fd = open(config_file, O_CREAT | O_EXCL | O_WRONLY, 0666); if (fd) { @@ -590,6 +592,7 @@ int cmd_config(int argc, const char **argv, const char *prefix) die_errno(_(cannot create configuration file %s), config_file); } launch_editor(config_file, NULL, NULL); + free(config_file); } else if (actions == ACTION_SET) { int ret; -- 2.1.1 -- 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