Re: prepare-commit-msg hook no longer run for cherry-pick?
On Tue, Jan 9, 2018 at 6:24 PM, Junio C Hamano <gits...@pobox.com> wrote: > > Dmitry Torokhov <dmitry.torok...@gmail.com> writes: > > >> I had prepare-commit-msg hook that would scrub "Patchwork-ID: " tags > >> form commit messages and would update input mailing list patchwork to > >> mark corresponding patches as "accepted" when I cherry pick form > >> WIP/review queue into branches that I publish, but that recently stopped > >> working if I do a simple cherry-pick. > > > > This seems like a regression, at least for my use case. Unfortunately > > my mail seems to get lost in the mailing list noise... > > Possibly. Can you bisect to see which commit broke things for you? > That would allow people who know what they themselves broke better > than I do to take a look ;-) Right, so it looks like the master works well, it is next(?) branch that is troublesome (apparently we pack experimental internally?). I bisected it down to: commit 356ee4659bb551cd9464b317d691827276752c2d (refs/bisect/bad) Author: Phillip Wood <phillip.w...@dunelm.org.uk> Date: Fri Nov 24 11:07:57 2017 + sequencer: try to commit without forking 'git commit' If the commit message does not need to be edited then create the commit without forking 'git commit'. Taking the best time of ten runs with a warm cache this reduces the time taken to cherry-pick 10 commits by 27% (from 282ms to 204ms), and the time taken by 'git rebase --continue' to pick 10 commits by 45% (from 386ms to 212ms) on my computer running linux. Some of greater saving for rebase is because it no longer wastes time creating the commit summary just to throw it away. The code to create the commit is based on builtin/commit.c. It is simplified as it doesn't have to deal with merges and modified so that it does not die but returns an error to make sure the sequencer exits cleanly, as it would when forking 'git commit' Even when not forking 'git commit' the commit message is written to a file and CHERRY_PICK_HEAD is created unnecessarily. This could be eliminated in future. I hacked up a version that does not write these files and just passed an strbuf (with the wrong message for fixup and squash commands) to do_commit() but I couldn't measure any significant time difference when running cherry-pick or rebase. I think eliminating the writes properly for rebase would require a bit of effort as the code would need to be restructured. Signed-off-by: Phillip Wood <phillip.w...@dunelm.org.uk> Signed-off-by: Junio C Hamano <gits...@pobox.com> With this commit the hook is not being run unless I specify '-e' flag to cherry-pick. Thanks. -- Dmitry
Re: prepare-commit-msg hook no longer run for cherry-pick?
Hi Junio, On Fri, Jan 5, 2018 at 10:48 AM, Dmitry Torokhov <dmitry.torok...@gmail.com> wrote: > Hi, > > I had prepare-commit-msg hook that would scrub "Patchwork-ID: " tags > form commit messages and would update input mailing list patchwork to > mark corresponding patches as "accepted" when I cherry pick form > WIP/review queue into branches that I publish, but that recently stopped > working if I do a simple cherry-pick. This seems like a regression, at least for my use case. Unfortunately my mail seems to get lost in the mailing list noise... Please let me know if this is indeed broken or I need to adjust my workflow. Thanks! > If I specify that I want to edit > the message, then the hook is executed: > > dtor@dtor-ws:~/kernel/master (for-linus)$ GIT_TRACE=2 git cherry-pick > ff162c1554efe951ba6c7a19a228fc76a91fe1ed > 10:43:12.832426 git.c:344 trace: built-in: git 'cherry-pick' > 'ff162c1554efe951ba6c7a19a228fc76a91fe1ed' > [for-linus 48bc600a3659] Input: raydium_i2c_ts - include hardware version in > firmware name > Author: Jeffrey Lin <jeffrey@rad-ic.com> > Date: Thu Jan 4 21:35:23 2018 -0800 > 1 file changed, 12 insertions(+), 2 deletions(-) > dtor@dtor-ws:~/kernel/master (for-linus)$ gti reset --hard HEAD^ > HEAD is now at 02a0d9216d4d Input: xen-kbdfront - do not advertise > multi-touch pressure support > dtor@dtor-ws:~/kernel/master (for-linus)$ GIT_TRACE=2 git cherry-pick -e > ff162c1554efe951ba6c7a19a228fc76a91fe1ed > 10:43:24.433162 git.c:344 trace: built-in: git 'cherry-pick' > '-e' 'ff162c1554efe951ba6c7a19a228fc76a91fe1ed' > 10:43:24.782355 run-command.c:627 trace: run_command: 'commit' '-n' '-e' > 10:43:24.786460 git.c:344 trace: built-in: git 'commit' '-n' > '-e' > 10:43:25.082164 run-command.c:627 trace: run_command: > '.git/hooks/prepare-commit-msg' '.git/COMMIT_EDITMSG' 'merge' > hint: Waiting for your editor to close the file... > 10:43:31.491551 run-command.c:627 trace: run_command: 'vim' > '/usr/local/goo gle/home/dtor/kernel/master/.git/COMMIT_EDITMSG' > [for-linus 039c57df0ec8] Input: raydium_i2c_ts - include hardware version in > firmware name > Author: Jeffrey Lin <jeffrey@rad-ic.com> > Date: Thu Jan 4 21:35:23 2018 -0800 > 1 file changed, 12 insertions(+), 2 deletions(-) > dtor@dtor-ws:~/kernel/master (for-linus)$ > > Also note that the argument to the hook is "merge" whereas I think it > used to be "cherry-pick" earlier. > > Is this behavior intentional? dpkg reports version as 2.16.0~rc0+next. > > Thanks! > > -- > Dmitry -- Dmitry
prepare-commit-msg hook no longer run for cherry-pick?
Hi, I had prepare-commit-msg hook that would scrub "Patchwork-ID: " tags form commit messages and would update input mailing list patchwork to mark corresponding patches as "accepted" when I cherry pick form WIP/review queue into branches that I publish, but that recently stopped working if I do a simple cherry-pick. If I specify that I want to edit the message, then the hook is executed: dtor@dtor-ws:~/kernel/master (for-linus)$ GIT_TRACE=2 git cherry-pick ff162c1554efe951ba6c7a19a228fc76a91fe1ed 10:43:12.832426 git.c:344 trace: built-in: git 'cherry-pick' 'ff162c1554efe951ba6c7a19a228fc76a91fe1ed' [for-linus 48bc600a3659] Input: raydium_i2c_ts - include hardware version in firmware name Author: Jeffrey Lin <jeffrey@rad-ic.com> Date: Thu Jan 4 21:35:23 2018 -0800 1 file changed, 12 insertions(+), 2 deletions(-) dtor@dtor-ws:~/kernel/master (for-linus)$ gti reset --hard HEAD^ HEAD is now at 02a0d9216d4d Input: xen-kbdfront - do not advertise multi-touch pressure support dtor@dtor-ws:~/kernel/master (for-linus)$ GIT_TRACE=2 git cherry-pick -e ff162c1554efe951ba6c7a19a228fc76a91fe1ed 10:43:24.433162 git.c:344 trace: built-in: git 'cherry-pick' '-e' 'ff162c1554efe951ba6c7a19a228fc76a91fe1ed' 10:43:24.782355 run-command.c:627 trace: run_command: 'commit' '-n' '-e' 10:43:24.786460 git.c:344 trace: built-in: git 'commit' '-n' '-e' 10:43:25.082164 run-command.c:627 trace: run_command: '.git/hooks/prepare-commit-msg' '.git/COMMIT_EDITMSG' 'merge' hint: Waiting for your editor to close the file... 10:43:31.491551 run-command.c:627 trace: run_command: 'vim' '/usr/local/goo gle/home/dtor/kernel/master/.git/COMMIT_EDITMSG' [for-linus 039c57df0ec8] Input: raydium_i2c_ts - include hardware version in firmware name Author: Jeffrey Lin <jeffrey@rad-ic.com> Date: Thu Jan 4 21:35:23 2018 -0800 1 file changed, 12 insertions(+), 2 deletions(-) dtor@dtor-ws:~/kernel/master (for-linus)$ Also note that the argument to the hook is "merge" whereas I think it used to be "cherry-pick" earlier. Is this behavior intentional? dpkg reports version as 2.16.0~rc0+next. Thanks! -- Dmitry
Re: Bare repository fetch/push race condition
Sorry for misleading subject. It should be "Race condition between pushing to and pushing from a bare repository"
Bare repository fetch/push race condition
It looks like there is a race condition between fetch and push in a bare repository in the following setup. There is a bare git repository on a local file system. Some process pushes to this repository via jgit. There is a cron task which pushes this repository to the backup remote repo over ssh. We observe the following in the reflog: 6932a831843f4dbe3b394acde9adc9a8269b6cf1 57b77b8c2a04029e7f5af4d3b7e36a3ba0c7cac9 XXX 1505903078 +0200push: forced-update 57b77b8c2a04029e7f5af4d3b7e36a3ba0c7cac9 44a221b0271b9abc885dd6e54f691d5248c4171f XXX 1505905206 +0200push: forced-update 44a221b0271b9abc885dd6e54f691d5248c4171f 57b77b8c2a04029e7f5af4d3b7e36a3ba0c7cac9 YYY1505905217 +0200 update by push Where XXX is the process pushing via jgit and YYY is the cron task. It looks like the cron task started a push when the ref was pointing to 57b77b8c2a04029e7f5af4d3b7e36a3ba0c7cac9 and push finished when the ref was already updated to 44a221b0271b9abc885dd6e54f691d5248c4171f. The push unconditionally updated the local tracking branch back to the commit 57b77b8c2a04029e7f5af4d3b7e36a3ba0c7cac9 and we lost the commit 44a221b0271b9abc885dd6e54f691d5248c4171f since the next push from the local process created a new commit with 57b77b8c2a04029e7f5af4d3b7e36a3ba0c7cac9 as a parent. Shouldn't the update_ref at transport.c:308 specify the expected old hash, like this: update_ref("update by push", rs.dst, ref->new_oid.hash, ref->old_oid.hash, 0, 0); at least for bare repositories?
'git submodules update' ignores credential.helper config of the parent repository
I'm checking out a repository in a non-interactive environment and would like to disable interactive credential helpers. According to [1] it can be done by specifying an empty helper in a local config: [credential] helper = But the submodule update command ignores the helper specified in the config of the parent repository. To reproduce it, fetch a repository with submodules requiring authentication and run: git submodule init; git submodule sync; git submodule update; the 'git submodule update' runs a default credential helper. The only way to disable it is specify helper in command-line: git -c credential.helper= submodule update Is it by design? [1] http://marc.info/?l=git=147136396024768=2
Re: [Question] Git histrory after greybus merge
Adding Cc: git list, Junio. 2016-10-26 15:55 GMT+03:00 Dmitry Safonov <0x7f454...@gmail.com>: > Hi, > > Is there any way to specify git-log or git-rev-list which root tree to use? > I mean, I got the following situation: > I saw the commit a67dd266adf4 ("netfilter: xtables: prepare for > on-demand hook register") > by git-blame and want to see commits on top of that particular commit. > Earlier I've used for that: > $ git log --reverse a67dd266adf4^..HEAD > > But now after merging greybus it follows the greybus's tree and shows me: > [linux]$ git log --reverse a67dd266adf4^..HEAD --oneline > cd26f1bd6bf3 greybus: Initial commit > c8a797a98cb6 greybus: Import most recent greybus code to new repo. > 06823c3eb9c4 greybus: README and .gitignore updates > > Which quite sucks as this isn't a hash I'm referencing. > Anyway, back to the question, is there any option to tell git which tree to > use? > I'm sure this was asked before (on btrfs merge?), but I didn't find > the answer so far. > I'm using git v2.10.1 if anything. > > Thanks, > Dmitry
Credential helpers processing order
Hi, I wonder why credential helpers are called in the order: system, global, local, command-line and not in the reverse order? This make it impossible to provide a custom helper and disable default ones via command-line parameter. My use-case is to clone a repository in a non-interactive environment where a system-level GUI helper is configured: clone hangs since system-level helper called first and there is no input from the user. Also if a system-level helper sets quit=true, then lower-level helpers won't be called at all. Is it by design? -- Dmitry -- 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 diff-index' doesn't honor the 'diff.algorithm' variable
On 05/15/2016 09:43 PM, Junio C Hamano wrote: I think the paragraph is shared among the "diff" family of commands both plumbing and Porcelain, so I'd say "patches welcome" at this point ;-). I think I've done my part here. It's not like this is a feature request. The script was an illustration of the logic--I am sure elisp is much core capable scripting environment than POSIX shell. Perhaps (setq vc-diff-git-diff-use-histogram t) in ~/.emacs is not too bad ;-) Yes, doing it via a user option is already possible in Emacs. I was concerned that the user has to configure it twice (once for console, two for Emacs), but if you think it's fine, let's leave it at that. The Porcelain "git diff" command is not bound by any promise of stable output and reserves the right to change the default to better support human users. I think the upcoming version of Git turns the diff.renames setting on by default, for example. We might even add a side-by-side diff and make it the default someday. You do not want to be reading these "fancy" output, and you cannot keep updating the invocation of "git diff" by vc-diff with unbounded number options, e.g. --no-side-by-side, that will be added to defeat configuration variables that will be invented in the future. Fair enough. Thanks, Dmitry. -- 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 diff-index' doesn't honor the 'diff.algorithm' variable
Hi Junio, On 05/14/2016 09:40 PM, Junio C Hamano wrote: The variable belongs to UI config, meant for Porcelain "git diff", together with things like "diff.color", "diff.context", etc. OK, that makes sense. You might want to fix the man page, though, it says, like the 'git diff' one, "For instance, if you configured diff.algorithm variable to a non-default value and want to use the default one, then you have to use --diff-algorithm=default option.". A script that calls diff-index, if it wants to honor end-users' UI config variables, is allowed to use 'git config' to read them and turn them into appropriate command line options. e.g. algo=$(git config diff.algorithm) case "$algo" in minimal|histogram|patience) algo=--$algo ;; *) algo= ;; esac ... git diff-index $algo ... other args ... or something like that. Thanks, but we don't distribute any custom Git porcelains with Emacs. We usually can't rely on bash being available either. Doing an extra process call from Emacs for this niche a feature doesn't seem like a great idea either. To clarify, the problem is that `M-x vc-diff' doesn't honor the diff.algorithm option. I'll have to see why we using 'git diff-index' there directly. Maybe we could switch to 'git diff'. -- 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 diff-index' doesn't honor the 'diff.algorithm' variable
Hi all, Subj. ...even though it's explicitly mentioned in the subcommand's man page. Git version 2.7.4 here. To elaborate: - Call 'git config --global diff.algorithm histogram'. - Try the example from http://stackoverflow.com/a/36551123/615245. 'git diff test.css' gives the expected output using the non-default algorithm. 'git diff-index -p HEAD -- test.css' uses the default one. Best regards, Dmitry. -- 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] remote-curl: don't fall back to Basic auth if we haven't tried Negotiate
Hi, guys! > I sent in a patch (and I believe I CC'd you) that adds an option > http.emptyAuth that can be used in this case. It should make its way to > a future release. Somehow I've missed your letter... > The patch has been queued as 121061f6 (http: add option to try > authentication without username, 2016-02-15); perhaps you can help > by trying it out in your installation before it hits a released > version of Git? That way, if the patch does not fix your problem, > or it introduces an unexpected side effect, we would notice before > we include it in a future release. I've cherry-picked commit 121061f6 over version 2.4.10 and 2.7.1. In both cases it works exactly as expected. Please, let me know if I can help with something else regarding this issue. 2016-02-21 0:38 GMT+03:00 Junio C Hamano <gits...@pobox.com>: > Dmitry Vilkov <dmitry.a.vil...@gmail.com> writes: > >> Hi guys! Any luck with fixing this issue? > > I think Brian suggested an alternative approach, to which you earler > responded > >>> That would be great! Definitely it will be much better solution than >>> patch I've proposed. > > The patch has been queued as 121061f6 (http: add option to try > authentication without username, 2016-02-15); perhaps you can help > by trying it out in your installation before it hits a released > version of Git? That way, if the patch does not fix your problem, > or it introduces an unexpected side effect, we would notice before > we include it in a future release. > > Thanks. > -- 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] remote-curl: don't fall back to Basic auth if we haven't tried Negotiate
Hi guys! Any luck with fixing this issue? I would like to draw your attention to the fact that Git starting from version 2.3.1 is unusable with servers that support GSS-Negotiation (e.g. Microsoft TFS). Sorry, english is not my native language and probably I was not clear enough when described the problem at first time. So, let me try again. Algorithm of fetching data through HTTP(S) protocol is as follows: 1. Try to fetch data without any credentials. 2. If first step failed 2.1. Disable GSS-Negotiation algorithm (this is the side effect which is fixed by my patch). 2.2. Read credentials from config files. 2.3. If there is no credentials then ask user for it. 2.4. Go to step one, but now try to fetch data with found/provided credentials. As you can see there is no other way to connect to server with GSS-Negotiation auth than use URLs like "https://:@my-gss-git-server.com; (because there is step zero where we are parsing URL which can contain credentials that we can use in step one). Maybe you could accept my patch, so users would use "credential.helper=store" to avoid using ":@" in remote URL? At least for now, while there is no good solution to this issue? It would be very helpful because now we have to have our own version of patched Git :( Thanks in advance. 2016-02-08 12:11 GMT+03:00 Dmitry Vilkov <dmitry.a.vil...@gmail.com>: > 2016-02-06 0:52 GMT+03:00 Junio C Hamano <gits...@pobox.com>: >> "brian m. carlson" <sand...@crustytoothpaste.net> writes: >> >>> On Fri, Feb 05, 2016 at 01:02:58PM -0800, Junio C Hamano wrote: >>>> Hmph, so documenting that :@ >>>> as a supported way might be an ugly-looking solution to the original >>>> problem. A less ugly-looking solution might be a boolean that can >>>> be set per URL (we already have urlmatch-config infrastructure to >>>> help us do so) to tell us to pass the empty credential to lubCurl, >>>> bypassing the step to ask the user for password that we do not use. >>>> >>>> The end-result of either of these solution would strictly be better >>>> than the patch we discussed in that the end user will not have to >>>> interact with the prompt at all, right? >>> >>> Yes, that's true. I'll try to come up with a patch this weekend that >>> implements that (maybe remote.forceAuth = true or somesuch). >> >> Thanks. >> >> I think the configuration should live inside http.* namespace, as >> there are already things like http[.].sslCert and friends. >> >> I do not have a good suggestion on the name of the leaf-level >> variable. ForceAuth sounds as if you are forcing authentication >> even when the other side does not require it, though. > > That would be great! Definitely it will be much better solution than > patch I've proposed. -- 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] remote-curl: don't fall back to Basic auth if we haven't tried Negotiate
2016-02-06 0:52 GMT+03:00 Junio C Hamano: > "brian m. carlson" writes: > >> On Fri, Feb 05, 2016 at 01:02:58PM -0800, Junio C Hamano wrote: >>> Hmph, so documenting that :@ >>> as a supported way might be an ugly-looking solution to the original >>> problem. A less ugly-looking solution might be a boolean that can >>> be set per URL (we already have urlmatch-config infrastructure to >>> help us do so) to tell us to pass the empty credential to lubCurl, >>> bypassing the step to ask the user for password that we do not use. >>> >>> The end-result of either of these solution would strictly be better >>> than the patch we discussed in that the end user will not have to >>> interact with the prompt at all, right? >> >> Yes, that's true. I'll try to come up with a patch this weekend that >> implements that (maybe remote.forceAuth = true or somesuch). > > Thanks. > > I think the configuration should live inside http.* namespace, as > there are already things like http[.].sslCert and friends. > > I do not have a good suggestion on the name of the leaf-level > variable. ForceAuth sounds as if you are forcing authentication > even when the other side does not require it, though. That would be great! Definitely it will be much better solution than patch I've proposed. -- 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] remote-curl: don't fall back to Basic auth if we haven't tried Negotiate
2016-02-03 2:29 GMT+03:00 brian m. carlson: > I'm unclear in what case you'd need to have a username and password > combination with GSS-Negotiate. Kerberos doesn't use your password, > although you need some indication of a username (valid or not) to get > libcurl to do authentication. > > Are you basically using a bare URL (without a username component) and > waiting for git to prompt you for the username, so that it will then > enable authentication? If so, this patch looks fine for that, although > I'd expand on the commit message. If not, could you provide an example > of what you're trying to do? You are right, we are using a bare URL (without a username component). With username encoded in URL everything works just fine. But it's generally wrong to pass creds in URL (in my opinion) and security policy of my employer prohibits doing such thing. Anyway, as you said libcurl needs valid (not NULL) username/password to do GSS-Negotiate, so there is nothing wrong if I set empty username/password combination when git prompts for creds. Even more, there is no other way to let libcurl to use GSS-Negotiate without username in URL. -- 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] remote-curl: don't fall back to Basic auth if we haven't tried Negotiate
This is fix of bug introduced by 4dbe66464 commit. The problem is that when username/password combination was not set, the first HTTP(S) request will fail and user will be asked for credentials. As a side effect of first HTTP(S) request, libcurl auth method GSS-Negotiate will be disabled unconditionally. Although, we haven't tried yet provided credentials for this auth method. Signed-off-by: Dmitry Vilkov <dmitry.a.vil...@gmail.com> --- http.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/http.c b/http.c index 0da9e66..707ea84 100644 --- a/http.c +++ b/http.c @@ -951,12 +951,15 @@ static int handle_curl_result(struct slot_results *results) return HTTP_MISSING_TARGET; else if (results->http_code == 401) { if (http_auth.username && http_auth.password) { +#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY + if (http_auth_methods & CURLAUTH_GSSNEGOTIATE) { + http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE; + return HTTP_REAUTH; + } +#endif credential_reject(_auth); return HTTP_NOAUTH; } else { -#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY - http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE; -#endif return HTTP_REAUTH; } } else { -- 2.4.10 -- 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] Fixed typo in Doc/gitrepository-layout
From: LDVSOFTgitrepository-layout.txt: In description of `info' directory, note about `$GIT_COMMON_DIR' was referencing `index' instead of `info'. Signed-off-by: LDVSOFT --- Documentation/gitrepository-layout.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt index 7173b38..e9c5411 100644 --- a/Documentation/gitrepository-layout.txt +++ b/Documentation/gitrepository-layout.txt @@ -177,7 +177,7 @@ sharedindex.:: info:: Additional information about the repository is recorded in this directory. This directory is ignored if $GIT_COMMON_DIR - is set and "$GIT_COMMON_DIR/index" will be used instead. + is set and "$GIT_COMMON_DIR/info" will be used instead. info/refs:: This file helps dumb transports discover what refs are -- https://github.com/git/git/pull/177 -- 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: Translate Pro Git book to Russian and Ukrainian
Good day! I am Russian and Ukrainian native speaker. I have a little free time and I want to help in translating. What I may do for it? -- 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 merge changes file mode from 644 to 755
Hello, I've noticed strange behavior of git merge on Windows with core.filemode=false (set by default). Git changed mode of some files from 644 to 755 for unknown reason. One of the files is stdafx.cpp, it's absent in the common ancestor, it was added in the first branch (master) with mode 644 and it's still absent in the second branch (feature). So, git merges the file without conflicts but changes mode from 644 to 755. Example with git merge: $ git reset --hard 9b90bac - the first branch $ git merge-base 9b90bac f41bd44 - the second branch e44b025b000fe71cf621b5aadad88e71d209e301 - the common ancestor $ git ls-tree 9b90bac stdafx.cpp 100644 blob 0bf386d4ae494503129921f5b5077a74976c8f91stdafx.cpp - 644 in the first branch $ git ls-tree e44b025 stdafx.cpp - absent in the common ancestor $ git ls-tree f41bd44 stdafx.cpp - absent in the second branch $ git merge f41bd44 Auto-merging stdafx.cpp $ git ls-files -s stdafx.cpp 100755 0bf386d4ae494503129921f5b5077a74976c8f91 0 stdafx.cpp - 755 after merge Example with git read-tree: $ git reset --hard 9b90bac $ git read-tree -m e44b025 9b90bac f41bd44 $ git ls-files -s stdafx.cpp 100644 0bf386d4ae494503129921f5b5077a74976c8f91 0 stdafx.cpp - 644 after read-tree -m Why git merge changes mode from 644 to 755? Is it a known issue? I use git version 1.9.5.msysgit.0. Maybe the issue was fixed in a later version? Regards, Dmitry -- 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: How do I resolve conflict after popping stash without adding the file to index?
On 04/22/2015 12:29 AM, Jeff King wrote: Hmm, interestingly, if you do _not_ stage the changes (i.e., drop the final git add there), you get: $ git stash pop error: Your local changes to the following files would be overwritten by merge: test Please, commit your changes or stash them before you can merge. Aborting which makes sense. Writing conflict markers into the file would leave you in a situation where it is hard to recover the b content. Indeed. But we seem to skip that safety valve when the content has been staged, which seems questionable to me (technically we are slightly better off than the protected case because b was written to a git blob object, so you can recover it. But it may be difficult to find the correct blob in the object database). Any suggestions how to restore that content in the index programmatically? If it's non-trivial to do, maybe that is indeed a bug, and 'git stash pop' should abort before creating the conflict. -- 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: How do I resolve conflict after popping stash without adding the file to index?
On 04/21/2015 12:11 AM, Junio C Hamano wrote: But the said file, if it had conflicted, would have had only the conflicted higher stage entries in the index, no? That is, the failed merge wouldn't have touched the index for the path if it already had changes there in the first place. I'm not really sure what higher stage entries are, but this scenario seems to be a counter-example: git init echo a test git add test git commit -m first echo aaa test git stash save echo b test git add test git stash pop Either that, or 'git stash pop' was a destructive operation, and ate the staged changes. If you want to keep them then you do not have to reset, but your question is about resolving conflict only in the working tree and leave the index clean, so I do not think git reset -- $path would not lose anything irreversibly. Rather, I'd prefer to leave the index as-is, if it makes sense. Basically, this is about tool automation, see the context here: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20292 -- 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
How do I resolve conflict after popping stash without adding the file to index?
Hi all, After the user does 'git stash pop', it may result in conflicts. However, in many cases they may not intend to commit the stashed changes right away, so staging the applied changes is often not what they intend to do. However, the conflict is there until you mark it as resolved. What's the proper thing to do there? 'git add file.ext' followed by 'git reset file.ext'? Or simply 'git reset file.ext'? Either will reset already-staged changes from the said file, which is an irreversible operation. Best regards, Dmitry. -- 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
submodule.$name.url is ignored during submodule update
Hi, I've noticed that the 'submodule.$name.url' config parameter from the main repository is ignored when a submodule needs to be updated, the submodule's 'remote.origin.url' is used instead. Is there any way to customize the submodule url for both the initial clone and for updates? -- Dmitry -- 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: submodule.$name.url is ignored during submodule update
I want to use a custom url for both initial submodule clone and submodule update. Git submodule man page states that if I run 'git submodule init' and then change the 'submodule.$name.url' in the main repository config, git will use this url instead of url in .gitmodules. Git does use the custom url for initial submodule clone, but doesn't use it when cloned submodule needs to be updated. Is that by design? On Thu, Mar 19, 2015 at 2:09 PM, Doug Kelly dougk@gmail.com wrote: On Thu, Mar 19, 2015 at 4:27 AM, Dmitry Neverov dmitry.neve...@gmail.com wrote: Hi, I've noticed that the 'submodule.$name.url' config parameter from the main repository is ignored when a submodule needs to be updated, the submodule's 'remote.origin.url' is used instead. Is there any way to customize the submodule url for both the initial clone and for updates? That's what git submodule sync is for. It will synchronize the url in .gitmodules with to the remote.origin.url for each submodule. I'm not sure about the second part of your question: are you talking about using different URLs for the initial clone and updates? -- 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: submodule.$name.url is ignored during submodule update
Sorry, my bad. I thought 'git submodule sync' changes only 'submodule.$name.url' in main repository config, but it also changes the 'remote.origin.url' in submodule's config. I indeed ran 'git submodule sync', that's why the default url was used even though 'submodule.$name.url' had a different value. On Thu, Mar 19, 2015 at 2:16 PM, Dmitry Neverov dmitry.neve...@gmail.com wrote: I want to use a custom url for both initial submodule clone and submodule update. Git submodule man page states that if I run 'git submodule init' and then change the 'submodule.$name.url' in the main repository config, git will use this url instead of url in .gitmodules. Git does use the custom url for initial submodule clone, but doesn't use it when cloned submodule needs to be updated. Is that by design? On Thu, Mar 19, 2015 at 2:09 PM, Doug Kelly dougk@gmail.com wrote: On Thu, Mar 19, 2015 at 4:27 AM, Dmitry Neverov dmitry.neve...@gmail.com wrote: Hi, I've noticed that the 'submodule.$name.url' config parameter from the main repository is ignored when a submodule needs to be updated, the submodule's 'remote.origin.url' is used instead. Is there any way to customize the submodule url for both the initial clone and for updates? That's what git submodule sync is for. It will synchronize the url in .gitmodules with to the remote.origin.url for each submodule. I'm not sure about the second part of your question: are you talking about using different URLs for the initial clone and updates? -- 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 gc removes all packs
I followed your advice and removed a symlink ref from my repository. But didn't help.. automatic GC has just removed all packs again. May alternates cause such a behavior? Are any ways to make gc log somewhere why it removes packs? On Thu, Feb 5, 2015 at 9:03 PM, Jeff King p...@peff.net wrote: On Thu, Feb 05, 2015 at 04:13:03PM +0100, Dmitry Neverov wrote: I'm using git p4 for synchronization with perforce. Sometimes after 'git p4 rebase' git starts a garbage collection. When gc finishes a local repository contains no pack files only loose objects, so I have to re-import repository from perforce. It also doesn't contain a temporary pack git gc was creating. It sounds like git didn't find any refs; it will pack only objects which are reachable. Unreachable objects are either: 1. Exploded into loose objects if the mtime on the pack they contain is less than 2 weeks old (and will eventually expire when they become 2 weeks old). 2. Dropped completely if older than 2 weeks. One more thing about my setup: since git p4 promotes a use of a linear history I use a separate repository for another branch in perforce. In order to be able to cherry-pick between repositories I added this another repo objects dir as an alternate and also added a ref which is a symbolic link to a branch in another repo (so I don't have to do any fetches). You can't symlink refs like this. The loose refs in the filesystem may be migrated into the packed-refs file, at which point your symlink will be broken. That is a likely reason why git would not find any refs. So your setup will not ever work reliably. But IMHO, it is a bug that git does not notice the broken symlink and abort an operation which is computing reachability in order to drop objects. As you noticed, it means a misconfiguration or filesystem error results in data loss. -Peff -- 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 gc removes all packs
Hi, I'm experiencing a strange behavior of automatic git gc which corrupts a local repository. Git version 2.2.2 on Mac OS X 10.10.1. I'm using git p4 for synchronization with perforce. Sometimes after 'git p4 rebase' git starts a garbage collection. When gc finishes a local repository contains no pack files only loose objects, so I have to re-import repository from perforce. It also doesn't contain a temporary pack git gc was creating. Command line history looks like this: git p4 rebase Performing incremental import into refs/remotes/p4/master git branch Depot paths: //XXX/YYY/ Import destination: refs/remotes/p4/master Importing revision 352157 (100%) Rebasing the current branch onto remotes/p4/master First, rewinding head to replay your work on top of it... Fast-forwarded master to remotes/p4/master. Auto packing the repository in background for optimum performance. See git help gc for manual housekeeping. ps aux | grep git nd 14335 95.0 1.4 4643292 114788 ?? R 8:52PM 0:05.79 git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog --indexed-objects --unpack-unreachable=2.weeks.ago --local --delta-base-offset /path/to/repo/.git/objects/pack/.tmp-14333-pack nd 14333 0.0 0.0 2452420920 ?? S 8:52PM 0:00.00 git repack -d -l -A --unpack-unreachable=2.weeks.ago nd 14331 0.0 0.0 2436036744 ?? Ss8:52PM 0:00.00 git gc --auto After the 14331 process termination all packs are gone. One more thing about my setup: since git p4 promotes a use of a linear history I use a separate repository for another branch in perforce. In order to be able to cherry-pick between repositories I added this another repo objects dir as an alternate and also added a ref which is a symbolic link to a branch in another repo (so I don't have to do any fetches). How do I troubleshoot the problem? Is there any way to enable a some kind of logging for automatic git gc? Can use of alternates or symbolic links in refs cause such a behavior? -- Dmitry -- 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
Probably a bug with ~ symbol in filenames on Windows 7 x64 in git 1.9.5
Hello, Recently I installed 1.9.5 git version and faced the problem that one of the files in my cloned repository with a name ICON~714.PNG is marked as deleted even repository was freshly cloned. Trying to do anything with that file resulted in constant Invalid Path errors. Reverting back to 1.9.4. fixed that problem. Thanks, Dmitry -- 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: Joining historical repository using grafts or replace
Hi Christian, On Thu, Oct 30, 2014 at 6:41 PM, Dmitry Oksenchuk oksenchu...@gmail.com wrote: 2014-10-30 19:54 GMT+03:00 Christian Couder christian.cou...@gmail.com: This might be a good idea. Did you already test that the small repository is really faster than the full repository? Yes, because of such amount of refs, push in historical repository takes 12 sec, push in working repository takes 0.4 sec, push in joined repository takes 2 sec. Local operations with history like log and blame work with the same speed in joined repository as in historical repository. What does joined mean? Does it mean joined using grafts? Or joined using replace refs? Or just the unsplit full repository? It's joined using grafts or replace. In both cases performance is the same. Also what is interesting is if local operations work with the same speed in the small working repository as in the unsplit full repository. Speed of operations like git diff, git add, git commit is exactly the same in both repositories. Operations like git log and git blame work much faster in repository without history (not surprisingly :) For example, git log in small repository takes 0.2 sec, in full repository - 0.8 sec. git blame in full repository can take up to 9 sec for large files with long history. Regards, Dmitry -- 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
Joining historical repository using grafts or replace
Hello, We're in the middle of conversion of a large CVS repository (20 years, 70K commits, 1K branches, 10K tags) to Git and considering two separate Git repositories: historical with CVS history and working created without history from heads of active branches (10 active branches). This allows us to have small fast working repository for developers who don't want to have full history locally and ability to rewrite history in historical repository (for example, to add parents to merge commits or to fix conversion mistakes) without affecting commit hashes in working repository (the hashes can be stored in bug tracker or in the code). The first idea was to use grafs to join branch roots in working repository with branches in historical repository like in linux repository but it seems that grafts are known as a horrible hack ( http://marc.info/?l=gitm=131127600030310w=2 http://permalink.gmane.org/gmane.comp.version-control.git/177153 ) Since Git 1.6.5 replace can also be used to join the histories by replacing branch roots in working repository with branch heads in historical repository. Both grafts and replace will be used locally. Grafts is a bit easier to distribute (simple copying, replaces should be created via bash script). Are there any disadvantages of using grafts and replace? Will both of them be supported in future versions of Git? Thank you, Dmitry -- 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: Joining historical repository using grafts or replace
Hi Christian, Thanks for your reply. 2014-10-30 19:54 GMT+03:00 Christian Couder christian.cou...@gmail.com: On Thu, Oct 30, 2014 at 4:39 PM, Dmitry Oksenchuk oksenchu...@gmail.com wrote: We're in the middle of conversion of a large CVS repository (20 years, 70K commits, 1K branches, 10K tags) to Git and considering two separate Git repositories: historical with CVS history and working created without history from heads of active branches (10 active branches). This allows us to have small fast working repository for developers who don't want to have full history locally and ability to rewrite history in historical repository (for example, to add parents to merge commits or to fix conversion mistakes) without affecting commit hashes in working repository (the hashes can be stored in bug tracker or in the code). This might be a good idea. Did you already test that the small repository is really faster than the full repository? Yes, because of such amount of refs, push in historical repository takes 12 sec, push in working repository takes 0.4 sec, push in joined repository takes 2 sec. Local operations with history like log and blame work with the same speed in joined repository as in historical repository. Are there any disadvantages of using grafts and replace? Will both of them be supported in future versions of Git? My opinion is that grafts have no advantage compared to replace refs. Once you have created your replace refs, they can be managed like other git refs, so they are easier to distribute. Basically if you want to get the full history on a computer you just need to do: git fetch 'refs/replace/*:refs/replace/*' That's true but you still need to have another remote with full history because it has lots of tags and branches that will be cloned by initial clone. Regards, Dmitry -- 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] Joining historical repository using grafts or replace
2014-10-30 18:44 GMT+03:00 W. Trevor King wk...@tremily.us: On Thu, Oct 30, 2014 at 06:39:56PM +0300, Dmitry Oksenchuk wrote: We're in the middle of conversion of a large CVS repository (20 years, 70K commits, 1K branches, 10K tags) to Git and considering two separate Git repositories: historical with CVS history and working created without history from heads of active branches (10 active branches). This allows us to have small fast working repository for developers who don't want to have full history locally and ability to rewrite history in historical repository (for example, to add parents to merge commits or to fix conversion mistakes) without affecting commit hashes in working repository (the hashes can be stored in bug tracker or in the code). A number of projects have done something like this (e.g. Linux). Modern Gits have good support for shallow repositories though, so I'd just make one full repository and leave it to developers to decide how deep they want their local copy to be. Good point. Shallow clone allows a developer to have a small fast repository if history is not needed. But having new history in one repository with CVS history prevents us from rewriting it in case of conversion mistakes or desire to restore parents in merge commits. Thanks, Dmitry -- 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
Unexpected end of command stream message looks irrelevant when I try to pull a non-existing branch
Hi, I'm using Git 1.8.1 and when I run the following command: git pull origin matser I get the following output: fatal: couldn't find remote ref matser Unexpected end of command stream The first line in the output is right on the money but the second one looks completely irrelevant - the command is well formed except I perhaps mistyped the branch name. It looks like there's some bug that prevents the program from just exiting after printing the first line and so the second line is being output. Could you please fix this? Thank you. Dmitry. -- -- 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] configure.ac: link with -liconv for locale_charset()
On e.g. FreeBSD 10.x, the following situation is common: - there's iconv implementation in libc, which has no locale_charset() function - there's GNU libiconv installed from Ports Collection Git build process - detects that iconv is in libc and thus -liconv is not needed for it - detects locale_charset in -liconv, but for some reason doesn't add it to CHARSET_LIB (as it would do with -lcharset if locale_charset() was found there instead of -liconv) - git doesn't build due to unresolved external locale_charset() Fix this by adding -liconv to CHARSET_LIB if locale_charset() is detected in this library. Signed-off-by: Dmitry Marakasov amd...@amdmi3.ru --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git configure.ac configure.ac index 2f43393..3f5c644 100644 --- configure.ac +++ configure.ac @@ -890,7 +890,7 @@ GIT_CONF_SUBST([HAVE_STRINGS_H]) # and libcharset does CHARSET_LIB= AC_CHECK_LIB([iconv], [locale_charset], - [], + [CHARSET_LIB=-liconv], [AC_CHECK_LIB([charset], [locale_charset], [CHARSET_LIB=-lcharset])]) GIT_CONF_SUBST([CHARSET_LIB]) -- 1.9.0 -- 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] configure.ac: link with -liconv for locale_charset()
* Junio C Hamano (gits...@pobox.com) wrote: On e.g. FreeBSD 10.x, the following situation is common: - there's iconv implementation in libc, which has no locale_charset() function - there's GNU libiconv installed from Ports Collection Git build process - detects that iconv is in libc and thus -liconv is not needed for it - detects locale_charset in -liconv, but for some reason doesn't add it to CHARSET_LIB (as it would do with -lcharset if locale_charset() was found there instead of -liconv) - git doesn't build due to unresolved external locale_charset() Fix this by adding -liconv to CHARSET_LIB if locale_charset() is detected in this library. Signed-off-by: Dmitry Marakasov amd...@amdmi3.ru --- Looks sensible; Dilyan, any comments? Addendum: build logs before and after the fix: http://people.freebsd.org/~amdmi3/git-iconv-fail.log http://people.freebsd.org/~amdmi3/git-iconv-fixed.log -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amd...@amdmi3.ru ..: jabber: amd...@jabber.ruhttp://www.amdmi3.ru -- 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] configure.ac: link with -liconv for locale_charset()
* Junio C Hamano (gits...@pobox.com) wrote: Looks sensible; Dilyan, any comments? Another addendum, comment from Tijl Coosemans t...@freebsd.org who just fixed this problem in FreeBSD ports (differently): --- Please let upstream know they should either use iconv from libc + nl_langinfo from libc, or iconv from libiconv + locale_charset from libiconv, but not mix the two. Actually they could just always use nl_langinfo when it's available because locale_charset is not much more than an alias for it. --- The fix used in ports was to just disable check for libcharset.h: http://www.freebsd.org/cgi/query-pr.cgi?pr=187326#reply3 -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amd...@amdmi3.ru ..: jabber: amd...@jabber.ruhttp://www.amdmi3.ru -- 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 push first asks for credentials, then checks the branch exists
Hi, Here's my usecase. I have created a BranchWithVeryLongName and I want to have it pushed to origin. So I use this command with version 1.8.1.2: git push origin BranchMistypedLongName (note that I mistyped the branch name). The following happens: 1. git asks me for username and password 2. it authenticates on the origin server 3. it bails out with error: sfc refspec BranchMistypedLongName does not match any Can't git perhaps check that the branch exists before it asks me for credentials and just say there's no such branch? Could you please fix this? Thank you. Dmitry. -- 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 00/14] Use ALLOC_GROW() instead of inline code
This version differs from previous [1] the following changes: - added three new commits with similar changes in builtin/mktree.c, cache-tree.c and sha1_file.c. - updated commit messages: use ALLOC_GROW() in function_name() instead of change function_name() to use ALLOC_GROW() - updated [PATCH v2 01/11] [2] to keep code lines within 80 columns in builtin/pack-objects.c Duy Nguyen, Michael Haggerty, Junio C Hamano, Eric Sunshine, and He Sun, thanks you very much for your remarks and advices [1] http://thread.gmane.org/gmane.comp.version-control.git/242919 [2] http://thread.gmane.org/gmane.comp.version-control.git/242920 Dmitry S. Dolzhenko (14): builtin/pack-objects.c: use ALLOC_GROW() in check_pbase_path() bundle.c: use ALLOC_GROW() in add_to_ref_list() cache-tree.c: use ALLOC_GROW() in find_subtree() commit.c: use ALLOC_GROW() in register_commit_graft() diff.c: use ALLOC_GROW() diffcore-rename.c: use ALLOC_GROW() patch-ids.c: use ALLOC_GROW() in add_commit() replace_object.c: use ALLOC_GROW() in register_replace_object() reflog-walk.c: use ALLOC_GROW() dir.c: use ALLOC_GROW() in create_simplify() attr.c: use ALLOC_GROW() in handle_attr_line() builtin/mktree.c: use ALLOC_GROW() in append_to_tree() read-cache.c: use ALLOC_GROW() in add_index_entry() sha1_file.c: use ALLOC_GROW() in pretend_sha1_file() attr.c | 7 +-- builtin/mktree.c | 5 + builtin/pack-objects.c | 9 +++-- bundle.c | 6 +- cache-tree.c | 6 +- commit.c | 8 ++-- diff.c | 12 ++-- diffcore-rename.c | 12 ++-- dir.c | 5 + patch-ids.c| 5 + read-cache.c | 6 +- reflog-walk.c | 12 ++-- replace_object.c | 8 ++-- sha1_file.c| 7 +-- 14 files changed, 21 insertions(+), 87 deletions(-) -- 1.8.3.2 -- 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 08/14] replace_object.c: use ALLOC_GROW() in register_replace_object()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- replace_object.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/replace_object.c b/replace_object.c index cdcaf8c..843deef 100644 --- a/replace_object.c +++ b/replace_object.c @@ -36,12 +36,8 @@ static int register_replace_object(struct replace_object *replace, return 1; } pos = -pos - 1; - if (replace_object_alloc = ++replace_object_nr) { - replace_object_alloc = alloc_nr(replace_object_alloc); - replace_object = xrealloc(replace_object, - sizeof(*replace_object) * - replace_object_alloc); - } + ALLOC_GROW(replace_object, replace_object_nr + 1, replace_object_alloc); + replace_object_nr++; if (pos replace_object_nr) memmove(replace_object + pos + 1, replace_object + pos, -- 1.8.3.2 -- 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 10/14] dir.c: use ALLOC_GROW() in create_simplify()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- dir.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 98bb50f..4ae38e4 100644 --- a/dir.c +++ b/dir.c @@ -1341,10 +1341,7 @@ static struct path_simplify *create_simplify(const char **pathspec) for (nr = 0 ; ; nr++) { const char *match; - if (nr = alloc) { - alloc = alloc_nr(alloc); - simplify = xrealloc(simplify, alloc * sizeof(*simplify)); - } + ALLOC_GROW(simplify, nr + 1, alloc); match = *pathspec++; if (!match) break; -- 1.8.3.2 -- 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 03/14] cache-tree.c: use ALLOC_GROW() in find_subtree()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- cache-tree.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cache-tree.c b/cache-tree.c index 0bbec43..30149d1 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -75,11 +75,7 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it, return NULL; pos = -pos-1; - if (it-subtree_alloc = it-subtree_nr) { - it-subtree_alloc = alloc_nr(it-subtree_alloc); - it-down = xrealloc(it-down, it-subtree_alloc * - sizeof(*it-down)); - } + ALLOC_GROW(it-down, it-subtree_nr + 1, it-subtree_alloc); it-subtree_nr++; down = xmalloc(sizeof(*down) + pathlen + 1); -- 1.8.3.2 -- 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 11/14] attr.c: use ALLOC_GROW() in handle_attr_line()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- attr.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/attr.c b/attr.c index 8d13d70..734222d 100644 --- a/attr.c +++ b/attr.c @@ -338,12 +338,7 @@ static void handle_attr_line(struct attr_stack *res, a = parse_attr_line(line, src, lineno, macro_ok); if (!a) return; - if (res-alloc = res-num_matches) { - res-alloc = alloc_nr(res-num_matches); - res-attrs = xrealloc(res-attrs, - sizeof(struct match_attr *) * - res-alloc); - } + ALLOC_GROW(res-attrs, res-num_matches + 1, res-alloc); res-attrs[res-num_matches++] = a; } -- 1.8.3.2 -- 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 06/14] diffcore-rename.c: use ALLOC_GROW()
Use ALLOC_GROW() instead inline code in locate_rename_dst() and register_rename_src() Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- diffcore-rename.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/diffcore-rename.c b/diffcore-rename.c index 9b4f068..fbf3272 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -38,11 +38,7 @@ static struct diff_rename_dst *locate_rename_dst(struct diff_filespec *two, if (!insert_ok) return NULL; /* insert to make it at first */ - if (rename_dst_alloc = rename_dst_nr) { - rename_dst_alloc = alloc_nr(rename_dst_alloc); - rename_dst = xrealloc(rename_dst, - rename_dst_alloc * sizeof(*rename_dst)); - } + ALLOC_GROW(rename_dst, rename_dst_nr + 1, rename_dst_alloc); rename_dst_nr++; if (first rename_dst_nr) memmove(rename_dst + first + 1, rename_dst + first, @@ -82,11 +78,7 @@ static struct diff_rename_src *register_rename_src(struct diff_filepair *p) } /* insert to make it at first */ - if (rename_src_alloc = rename_src_nr) { - rename_src_alloc = alloc_nr(rename_src_alloc); - rename_src = xrealloc(rename_src, - rename_src_alloc * sizeof(*rename_src)); - } + ALLOC_GROW(rename_src, rename_src_nr + 1, rename_src_alloc); rename_src_nr++; if (first rename_src_nr) memmove(rename_src + first + 1, rename_src + first, -- 1.8.3.2 -- 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 05/14] diff.c: use ALLOC_GROW()
Use ALLOC_GROW() instead inline code in diffstat_add() and diff_q() Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- diff.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/diff.c b/diff.c index e800666..aebdfda 100644 --- a/diff.c +++ b/diff.c @@ -1361,11 +1361,7 @@ static struct diffstat_file *diffstat_add(struct diffstat_t *diffstat, { struct diffstat_file *x; x = xcalloc(sizeof (*x), 1); - if (diffstat-nr == diffstat-alloc) { - diffstat-alloc = alloc_nr(diffstat-alloc); - diffstat-files = xrealloc(diffstat-files, - diffstat-alloc * sizeof(x)); - } + ALLOC_GROW(diffstat-files, diffstat-nr + 1, diffstat-alloc); diffstat-files[diffstat-nr++] = x; if (name_b) { x-from_name = xstrdup(name_a); @@ -3965,11 +3961,7 @@ struct diff_queue_struct diff_queued_diff; void diff_q(struct diff_queue_struct *queue, struct diff_filepair *dp) { - if (queue-alloc = queue-nr) { - queue-alloc = alloc_nr(queue-alloc); - queue-queue = xrealloc(queue-queue, - sizeof(dp) * queue-alloc); - } + ALLOC_GROW(queue-queue, queue-nr + 1, queue-alloc); queue-queue[queue-nr++] = dp; } -- 1.8.3.2 -- 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 02/14] bundle.c: use ALLOC_GROW() in add_to_ref_list()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- bundle.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bundle.c b/bundle.c index e99065c..1388a3e 100644 --- a/bundle.c +++ b/bundle.c @@ -14,11 +14,7 @@ static const char bundle_signature[] = # v2 git bundle\n; static void add_to_ref_list(const unsigned char *sha1, const char *name, struct ref_list *list) { - if (list-nr + 1 = list-alloc) { - list-alloc = alloc_nr(list-nr + 1); - list-list = xrealloc(list-list, - list-alloc * sizeof(list-list[0])); - } + ALLOC_GROW(list-list, list-nr + 1, list-alloc); memcpy(list-list[list-nr].sha1, sha1, 20); list-list[list-nr].name = xstrdup(name); list-nr++; -- 1.8.3.2 -- 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 01/14] builtin/pack-objects.c: use ALLOC_GROW() in check_pbase_path()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- builtin/pack-objects.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c733379..0ffad6f 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1213,12 +1213,9 @@ static int check_pbase_path(unsigned hash) if (0 = pos) return 1; pos = -pos - 1; - if (done_pbase_paths_alloc = done_pbase_paths_num) { - done_pbase_paths_alloc = alloc_nr(done_pbase_paths_alloc); - done_pbase_paths = xrealloc(done_pbase_paths, - done_pbase_paths_alloc * - sizeof(unsigned)); - } + ALLOC_GROW(done_pbase_paths, + done_pbase_paths_num + 1, + done_pbase_paths_alloc); done_pbase_paths_num++; if (pos done_pbase_paths_num) memmove(done_pbase_paths + pos + 1, -- 1.8.3.2 -- 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 14/14] sha1_file.c: use ALLOC_GROW() in pretend_sha1_file()
Helped-by: He Sun sunheeh...@gmail.com Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- sha1_file.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sha1_file.c b/sha1_file.c index 019628a..3cb17b8 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2624,12 +2624,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type, hash_sha1_file(buf, len, typename(type), sha1); if (has_sha1_file(sha1) || find_cached_object(sha1)) return 0; - if (cached_object_alloc = cached_object_nr) { - cached_object_alloc = alloc_nr(cached_object_alloc); - cached_objects = xrealloc(cached_objects, - sizeof(*cached_objects) * - cached_object_alloc); - } + ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc); co = cached_objects[cached_object_nr++]; co-size = len; co-type = type; -- 1.8.3.2 -- 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 04/14] commit.c: use ALLOC_GROW() in register_commit_graft()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- commit.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/commit.c b/commit.c index 6bf4fe0..e004314 100644 --- a/commit.c +++ b/commit.c @@ -147,12 +147,8 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups) return 1; } pos = -pos - 1; - if (commit_graft_alloc = ++commit_graft_nr) { - commit_graft_alloc = alloc_nr(commit_graft_alloc); - commit_graft = xrealloc(commit_graft, - sizeof(*commit_graft) * - commit_graft_alloc); - } + ALLOC_GROW(commit_graft, commit_graft_nr + 1, commit_graft_alloc); + commit_graft_nr++; if (pos commit_graft_nr) memmove(commit_graft + pos + 1, commit_graft + pos, -- 1.8.3.2 -- 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 13/14] read-cache.c: use ALLOC_GROW() in add_index_entry()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- read-cache.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/read-cache.c b/read-cache.c index fb440b4..cbdf954 100644 --- a/read-cache.c +++ b/read-cache.c @@ -990,11 +990,7 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti } /* Make sure the array is big enough .. */ - if (istate-cache_nr == istate-cache_alloc) { - istate-cache_alloc = alloc_nr(istate-cache_alloc); - istate-cache = xrealloc(istate-cache, - istate-cache_alloc * sizeof(*istate-cache)); - } + ALLOC_GROW(istate-cache, istate-cache_nr + 1, istate-cache_alloc); /* Add it in.. */ istate-cache_nr++; -- 1.8.3.2 -- 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 07/14] patch-ids.c: use ALLOC_GROW() in add_commit()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- patch-ids.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/patch-ids.c b/patch-ids.c index bc8a28f..bf81b92 100644 --- a/patch-ids.c +++ b/patch-ids.c @@ -83,10 +83,7 @@ static struct patch_id *add_commit(struct commit *commit, ent = bucket-bucket[bucket-nr++]; hashcpy(ent-patch_id, sha1); - if (ids-alloc = ids-nr) { - ids-alloc = alloc_nr(ids-nr); - ids-table = xrealloc(ids-table, sizeof(ent) * ids-alloc); - } + ALLOC_GROW(ids-table, ids-nr + 1, ids-alloc); if (pos ids-nr) memmove(ids-table + pos + 1, ids-table + pos, sizeof(ent) * (ids-nr - pos)); -- 1.8.3.2 -- 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 09/14] reflog-walk.c: use ALLOC_GROW()
Use ALLOC_GROW() instead inline code in add_commit_info() and read_one_reflog() Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- reflog-walk.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/reflog-walk.c b/reflog-walk.c index b2fbdb2..2899729 100644 --- a/reflog-walk.c +++ b/reflog-walk.c @@ -26,11 +26,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1, struct complete_reflogs *array = cb_data; struct reflog_info *item; - if (array-nr = array-alloc) { - array-alloc = alloc_nr(array-nr + 1); - array-items = xrealloc(array-items, array-alloc * - sizeof(struct reflog_info)); - } + ALLOC_GROW(array-items, array-nr + 1, array-alloc); item = array-items + array-nr; memcpy(item-osha1, osha1, 20); memcpy(item-nsha1, nsha1, 20); @@ -114,11 +110,7 @@ static void add_commit_info(struct commit *commit, void *util, struct commit_info_lifo *lifo) { struct commit_info *info; - if (lifo-nr = lifo-alloc) { - lifo-alloc = alloc_nr(lifo-nr + 1); - lifo-items = xrealloc(lifo-items, - lifo-alloc * sizeof(struct commit_info)); - } + ALLOC_GROW(lifo-items, lifo-nr + 1, lifo-alloc); info = lifo-items + lifo-nr; info-commit = commit; info-util = util; -- 1.8.3.2 -- 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 12/14] builtin/mktree.c: use ALLOC_GROW() in append_to_tree()
Helped-by: He Sun sunheeh...@gmail.com Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- builtin/mktree.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/builtin/mktree.c b/builtin/mktree.c index f92ba40..a964d6b 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -23,10 +23,7 @@ static void append_to_tree(unsigned mode, unsigned char *sha1, char *path) if (strchr(path, '/')) die(path %s contains slash, path); - if (alloc = used) { - alloc = alloc_nr(used); - entries = xrealloc(entries, sizeof(*entries) * alloc); - } + ALLOC_GROW(entries, used + 1, alloc); ent = entries[used++] = xmalloc(sizeof(**entries) + len + 1); ent-mode = mode; ent-len = len; -- 1.8.3.2 -- 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 00/11] Use ALLOC_GROW() instead of inline code
Dmitry S. Dolzhenko (11): builtin/pack-objects.c: use ALLOC_GROW() in check_pbase_path() bundle.c: use ALLOC_GROW() in add_to_ref_list() cache-tree.c: use ALLOC_GROW() in find_subtree() commit.c: use ALLOC_GROW() in register_commit_graft() diff.c: use ALLOC_GROW() diffcore-rename.c: use ALLOC_GROW() patch-ids.c: use ALLOC_GROW() in add_commit() replace_object.c: use ALLOC_GROW() in register_replace_object() reflog-walk.c: use ALLOC_GROW() dir.c: use ALLOC_GROW() in create_simplify() attr.c: use ALLOC_GROW() in handle_attr_line() attr.c | 7 +-- builtin/pack-objects.c | 9 +++-- bundle.c | 6 +- cache-tree.c | 6 +- commit.c | 8 ++-- diff.c | 12 ++-- diffcore-rename.c | 12 ++-- dir.c | 5 + patch-ids.c| 5 + reflog-walk.c | 12 ++-- replace_object.c | 8 ++-- 11 files changed, 18 insertions(+), 72 deletions(-) -- 1.8.5.3 This version differs from previous only minor changes: - update commit messages - keep code lines within 80 columns -- 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 01/11] builtin/pack-objects.c: use ALLOC_GROW() in check_pbase_path()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- builtin/pack-objects.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c733379..0ffad6f 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1213,12 +1213,9 @@ static int check_pbase_path(unsigned hash) if (0 = pos) return 1; pos = -pos - 1; - if (done_pbase_paths_alloc = done_pbase_paths_num) { - done_pbase_paths_alloc = alloc_nr(done_pbase_paths_alloc); - done_pbase_paths = xrealloc(done_pbase_paths, - done_pbase_paths_alloc * - sizeof(unsigned)); - } + ALLOC_GROW(done_pbase_paths, + done_pbase_paths_num + 1, + done_pbase_paths_alloc); done_pbase_paths_num++; if (pos done_pbase_paths_num) memmove(done_pbase_paths + pos + 1, -- 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
[PATCH v3 02/11] bundle.c: use ALLOC_GROW() in add_to_ref_list()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- bundle.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bundle.c b/bundle.c index e99065c..1388a3e 100644 --- a/bundle.c +++ b/bundle.c @@ -14,11 +14,7 @@ static const char bundle_signature[] = # v2 git bundle\n; static void add_to_ref_list(const unsigned char *sha1, const char *name, struct ref_list *list) { - if (list-nr + 1 = list-alloc) { - list-alloc = alloc_nr(list-nr + 1); - list-list = xrealloc(list-list, - list-alloc * sizeof(list-list[0])); - } + ALLOC_GROW(list-list, list-nr + 1, list-alloc); memcpy(list-list[list-nr].sha1, sha1, 20); list-list[list-nr].name = xstrdup(name); list-nr++; -- 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
[PATCH v3 04/11] commit.c: use ALLOC_GROW() in register_commit_graft()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- commit.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/commit.c b/commit.c index 6bf4fe0..e004314 100644 --- a/commit.c +++ b/commit.c @@ -147,12 +147,8 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups) return 1; } pos = -pos - 1; - if (commit_graft_alloc = ++commit_graft_nr) { - commit_graft_alloc = alloc_nr(commit_graft_alloc); - commit_graft = xrealloc(commit_graft, - sizeof(*commit_graft) * - commit_graft_alloc); - } + ALLOC_GROW(commit_graft, commit_graft_nr + 1, commit_graft_alloc); + commit_graft_nr++; if (pos commit_graft_nr) memmove(commit_graft + pos + 1, commit_graft + pos, -- 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
[PATCH v3 03/11] cache-tree.c: use ALLOC_GROW() in find_subtree()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- cache-tree.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cache-tree.c b/cache-tree.c index 0bbec43..30149d1 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -75,11 +75,7 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it, return NULL; pos = -pos-1; - if (it-subtree_alloc = it-subtree_nr) { - it-subtree_alloc = alloc_nr(it-subtree_alloc); - it-down = xrealloc(it-down, it-subtree_alloc * - sizeof(*it-down)); - } + ALLOC_GROW(it-down, it-subtree_nr + 1, it-subtree_alloc); it-subtree_nr++; down = xmalloc(sizeof(*down) + pathlen + 1); -- 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
[PATCH v3 05/11] diff.c: use ALLOC_GROW()
Use ALLOC_GROW() instead inline code in diffstat_add() and diff_q() Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- diff.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/diff.c b/diff.c index e800666..aebdfda 100644 --- a/diff.c +++ b/diff.c @@ -1361,11 +1361,7 @@ static struct diffstat_file *diffstat_add(struct diffstat_t *diffstat, { struct diffstat_file *x; x = xcalloc(sizeof (*x), 1); - if (diffstat-nr == diffstat-alloc) { - diffstat-alloc = alloc_nr(diffstat-alloc); - diffstat-files = xrealloc(diffstat-files, - diffstat-alloc * sizeof(x)); - } + ALLOC_GROW(diffstat-files, diffstat-nr + 1, diffstat-alloc); diffstat-files[diffstat-nr++] = x; if (name_b) { x-from_name = xstrdup(name_a); @@ -3965,11 +3961,7 @@ struct diff_queue_struct diff_queued_diff; void diff_q(struct diff_queue_struct *queue, struct diff_filepair *dp) { - if (queue-alloc = queue-nr) { - queue-alloc = alloc_nr(queue-alloc); - queue-queue = xrealloc(queue-queue, - sizeof(dp) * queue-alloc); - } + ALLOC_GROW(queue-queue, queue-nr + 1, queue-alloc); queue-queue[queue-nr++] = dp; } -- 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
[PATCH v3 06/11] diffcore-rename.c: use ALLOC_GROW()
Use ALLOC_GROW() instead inline code in locate_rename_dst() and register_rename_src() Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- diffcore-rename.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/diffcore-rename.c b/diffcore-rename.c index 9b4f068..fbf3272 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -38,11 +38,7 @@ static struct diff_rename_dst *locate_rename_dst(struct diff_filespec *two, if (!insert_ok) return NULL; /* insert to make it at first */ - if (rename_dst_alloc = rename_dst_nr) { - rename_dst_alloc = alloc_nr(rename_dst_alloc); - rename_dst = xrealloc(rename_dst, - rename_dst_alloc * sizeof(*rename_dst)); - } + ALLOC_GROW(rename_dst, rename_dst_nr + 1, rename_dst_alloc); rename_dst_nr++; if (first rename_dst_nr) memmove(rename_dst + first + 1, rename_dst + first, @@ -82,11 +78,7 @@ static struct diff_rename_src *register_rename_src(struct diff_filepair *p) } /* insert to make it at first */ - if (rename_src_alloc = rename_src_nr) { - rename_src_alloc = alloc_nr(rename_src_alloc); - rename_src = xrealloc(rename_src, - rename_src_alloc * sizeof(*rename_src)); - } + ALLOC_GROW(rename_src, rename_src_nr + 1, rename_src_alloc); rename_src_nr++; if (first rename_src_nr) memmove(rename_src + first + 1, rename_src + first, -- 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
[PATCH v3 07/11] patch-ids.c: use ALLOC_GROW() in add_commit()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- patch-ids.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/patch-ids.c b/patch-ids.c index bc8a28f..bf81b92 100644 --- a/patch-ids.c +++ b/patch-ids.c @@ -83,10 +83,7 @@ static struct patch_id *add_commit(struct commit *commit, ent = bucket-bucket[bucket-nr++]; hashcpy(ent-patch_id, sha1); - if (ids-alloc = ids-nr) { - ids-alloc = alloc_nr(ids-nr); - ids-table = xrealloc(ids-table, sizeof(ent) * ids-alloc); - } + ALLOC_GROW(ids-table, ids-nr + 1, ids-alloc); if (pos ids-nr) memmove(ids-table + pos + 1, ids-table + pos, sizeof(ent) * (ids-nr - pos)); -- 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
[PATCH v3 08/11] replace_object.c: use ALLOC_GROW() in register_replace_object()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- replace_object.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/replace_object.c b/replace_object.c index cdcaf8c..843deef 100644 --- a/replace_object.c +++ b/replace_object.c @@ -36,12 +36,8 @@ static int register_replace_object(struct replace_object *replace, return 1; } pos = -pos - 1; - if (replace_object_alloc = ++replace_object_nr) { - replace_object_alloc = alloc_nr(replace_object_alloc); - replace_object = xrealloc(replace_object, - sizeof(*replace_object) * - replace_object_alloc); - } + ALLOC_GROW(replace_object, replace_object_nr + 1, replace_object_alloc); + replace_object_nr++; if (pos replace_object_nr) memmove(replace_object + pos + 1, replace_object + pos, -- 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
[PATCH v3 09/11] reflog-walk.c: use ALLOC_GROW()
Use ALLOC_GROW() instead inline code in add_commit_info() and read_one_reflog() Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- reflog-walk.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/reflog-walk.c b/reflog-walk.c index b2fbdb2..2899729 100644 --- a/reflog-walk.c +++ b/reflog-walk.c @@ -26,11 +26,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1, struct complete_reflogs *array = cb_data; struct reflog_info *item; - if (array-nr = array-alloc) { - array-alloc = alloc_nr(array-nr + 1); - array-items = xrealloc(array-items, array-alloc * - sizeof(struct reflog_info)); - } + ALLOC_GROW(array-items, array-nr + 1, array-alloc); item = array-items + array-nr; memcpy(item-osha1, osha1, 20); memcpy(item-nsha1, nsha1, 20); @@ -114,11 +110,7 @@ static void add_commit_info(struct commit *commit, void *util, struct commit_info_lifo *lifo) { struct commit_info *info; - if (lifo-nr = lifo-alloc) { - lifo-alloc = alloc_nr(lifo-nr + 1); - lifo-items = xrealloc(lifo-items, - lifo-alloc * sizeof(struct commit_info)); - } + ALLOC_GROW(lifo-items, lifo-nr + 1, lifo-alloc); info = lifo-items + lifo-nr; info-commit = commit; info-util = util; -- 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
[PATCH v3 10/11] dir.c: use ALLOC_GROW() in create_simplify()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- dir.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 98bb50f..4ae38e4 100644 --- a/dir.c +++ b/dir.c @@ -1341,10 +1341,7 @@ static struct path_simplify *create_simplify(const char **pathspec) for (nr = 0 ; ; nr++) { const char *match; - if (nr = alloc) { - alloc = alloc_nr(alloc); - simplify = xrealloc(simplify, alloc * sizeof(*simplify)); - } + ALLOC_GROW(simplify, nr + 1, alloc); match = *pathspec++; if (!match) break; -- 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
[PATCH v3 11/11] attr.c: use ALLOC_GROW() in handle_attr_line()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- attr.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/attr.c b/attr.c index 8d13d70..734222d 100644 --- a/attr.c +++ b/attr.c @@ -338,12 +338,7 @@ static void handle_attr_line(struct attr_stack *res, a = parse_attr_line(line, src, lineno, macro_ok); if (!a) return; - if (res-alloc = res-num_matches) { - res-alloc = alloc_nr(res-num_matches); - res-attrs = xrealloc(res-attrs, - sizeof(struct match_attr *) * - res-alloc); - } + ALLOC_GROW(res-attrs, res-num_matches + 1, res-alloc); res-attrs[res-num_matches++] = a; } -- 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
[PATCH v2 00/11] Use ALLOC_GROW() instead of inline code
Thank you for your remarks. In this patch I tried to take them into account. Dmitry S. Dolzhenko (11): builtin/pack-objects.c: change check_pbase_path() to use ALLOC_GROW() bundle.c: change add_to_ref_list() to use ALLOC_GROW() cache-tree.c: change find_subtree() to use ALLOC_GROW() commit.c: change register_commit_graft() to use ALLOC_GROW() diff.c: use ALLOC_GROW() instead of inline code diffcore-rename.c: use ALLOC_GROW() instead of inline code patch-ids.c: change add_commit() to use ALLOC_GROW() replace_object.c: change register_replace_object() to use ALLOC_GROW() reflog-walk.c: use ALLOC_GROW() instead of inline code dir.c: change create_simplify() to use ALLOC_GROW() attr.c: change handle_attr_line() to use ALLOC_GROW() attr.c | 7 +-- builtin/pack-objects.c | 7 +-- bundle.c | 6 +- cache-tree.c | 6 +- commit.c | 8 ++-- diff.c | 12 ++-- diffcore-rename.c | 12 ++-- dir.c | 5 + patch-ids.c| 5 + reflog-walk.c | 13 +++-- replace_object.c | 8 ++-- 11 files changed, 17 insertions(+), 72 deletions(-) -- 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
[PATCH v2 01/11] builtin/pack-objects.c: change check_pbase_path() to use ALLOC_GROW()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- builtin/pack-objects.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c733379..56a6fc8 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1213,12 +1213,7 @@ static int check_pbase_path(unsigned hash) if (0 = pos) return 1; pos = -pos - 1; - if (done_pbase_paths_alloc = done_pbase_paths_num) { - done_pbase_paths_alloc = alloc_nr(done_pbase_paths_alloc); - done_pbase_paths = xrealloc(done_pbase_paths, - done_pbase_paths_alloc * - sizeof(unsigned)); - } + ALLOC_GROW(done_pbase_paths, done_pbase_paths_num + 1, done_pbase_paths_alloc); done_pbase_paths_num++; if (pos done_pbase_paths_num) memmove(done_pbase_paths + pos + 1, -- 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
[PATCH v2 02/11] bundle.c: change add_to_ref_list() to use ALLOC_GROW()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- bundle.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bundle.c b/bundle.c index e99065c..1388a3e 100644 --- a/bundle.c +++ b/bundle.c @@ -14,11 +14,7 @@ static const char bundle_signature[] = # v2 git bundle\n; static void add_to_ref_list(const unsigned char *sha1, const char *name, struct ref_list *list) { - if (list-nr + 1 = list-alloc) { - list-alloc = alloc_nr(list-nr + 1); - list-list = xrealloc(list-list, - list-alloc * sizeof(list-list[0])); - } + ALLOC_GROW(list-list, list-nr + 1, list-alloc); memcpy(list-list[list-nr].sha1, sha1, 20); list-list[list-nr].name = xstrdup(name); list-nr++; -- 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
[PATCH v2 03/11] cache-tree.c: change find_subtree() to use ALLOC_GROW()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- cache-tree.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cache-tree.c b/cache-tree.c index 0bbec43..30149d1 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -75,11 +75,7 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it, return NULL; pos = -pos-1; - if (it-subtree_alloc = it-subtree_nr) { - it-subtree_alloc = alloc_nr(it-subtree_alloc); - it-down = xrealloc(it-down, it-subtree_alloc * - sizeof(*it-down)); - } + ALLOC_GROW(it-down, it-subtree_nr + 1, it-subtree_alloc); it-subtree_nr++; down = xmalloc(sizeof(*down) + pathlen + 1); -- 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
[PATCH v2 04/11] commit.c: change register_commit_graft() to use ALLOC_GROW()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- commit.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/commit.c b/commit.c index 6bf4fe0..e004314 100644 --- a/commit.c +++ b/commit.c @@ -147,12 +147,8 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups) return 1; } pos = -pos - 1; - if (commit_graft_alloc = ++commit_graft_nr) { - commit_graft_alloc = alloc_nr(commit_graft_alloc); - commit_graft = xrealloc(commit_graft, - sizeof(*commit_graft) * - commit_graft_alloc); - } + ALLOC_GROW(commit_graft, commit_graft_nr + 1, commit_graft_alloc); + commit_graft_nr++; if (pos commit_graft_nr) memmove(commit_graft + pos + 1, commit_graft + pos, -- 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
[PATCH v2 05/11] diff.c: use ALLOC_GROW() instead of inline code
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- diff.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/diff.c b/diff.c index e800666..aebdfda 100644 --- a/diff.c +++ b/diff.c @@ -1361,11 +1361,7 @@ static struct diffstat_file *diffstat_add(struct diffstat_t *diffstat, { struct diffstat_file *x; x = xcalloc(sizeof (*x), 1); - if (diffstat-nr == diffstat-alloc) { - diffstat-alloc = alloc_nr(diffstat-alloc); - diffstat-files = xrealloc(diffstat-files, - diffstat-alloc * sizeof(x)); - } + ALLOC_GROW(diffstat-files, diffstat-nr + 1, diffstat-alloc); diffstat-files[diffstat-nr++] = x; if (name_b) { x-from_name = xstrdup(name_a); @@ -3965,11 +3961,7 @@ struct diff_queue_struct diff_queued_diff; void diff_q(struct diff_queue_struct *queue, struct diff_filepair *dp) { - if (queue-alloc = queue-nr) { - queue-alloc = alloc_nr(queue-alloc); - queue-queue = xrealloc(queue-queue, - sizeof(dp) * queue-alloc); - } + ALLOC_GROW(queue-queue, queue-nr + 1, queue-alloc); queue-queue[queue-nr++] = dp; } -- 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
[PATCH v2 08/11] replace_object.c: change register_replace_object() to use ALLOC_GROW()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- replace_object.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/replace_object.c b/replace_object.c index cdcaf8c..843deef 100644 --- a/replace_object.c +++ b/replace_object.c @@ -36,12 +36,8 @@ static int register_replace_object(struct replace_object *replace, return 1; } pos = -pos - 1; - if (replace_object_alloc = ++replace_object_nr) { - replace_object_alloc = alloc_nr(replace_object_alloc); - replace_object = xrealloc(replace_object, - sizeof(*replace_object) * - replace_object_alloc); - } + ALLOC_GROW(replace_object, replace_object_nr + 1, replace_object_alloc); + replace_object_nr++; if (pos replace_object_nr) memmove(replace_object + pos + 1, replace_object + pos, -- 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
[PATCH v2 09/11] reflog-walk.c: use ALLOC_GROW() instead of inline code
Affected functions: read_one_reflog(), add_commit_info() Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- reflog-walk.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/reflog-walk.c b/reflog-walk.c index b2fbdb2..879d2ed 100644 --- a/reflog-walk.c +++ b/reflog-walk.c @@ -26,11 +26,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1, struct complete_reflogs *array = cb_data; struct reflog_info *item; - if (array-nr = array-alloc) { - array-alloc = alloc_nr(array-nr + 1); - array-items = xrealloc(array-items, array-alloc * - sizeof(struct reflog_info)); - } + ALLOC_GROW(array-items, array-nr + 1, array-alloc); item = array-items + array-nr; memcpy(item-osha1, osha1, 20); memcpy(item-nsha1, nsha1, 20); @@ -114,11 +110,8 @@ static void add_commit_info(struct commit *commit, void *util, struct commit_info_lifo *lifo) { struct commit_info *info; - if (lifo-nr = lifo-alloc) { - lifo-alloc = alloc_nr(lifo-nr + 1); - lifo-items = xrealloc(lifo-items, - lifo-alloc * sizeof(struct commit_info)); - } + + ALLOC_GROW(lifo-items, lifo-nr + 1, lifo-alloc); info = lifo-items + lifo-nr; info-commit = commit; info-util = util; -- 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
[PATCH v2 10/11] dir.c: change create_simplify() to use ALLOC_GROW()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- dir.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 98bb50f..4ae38e4 100644 --- a/dir.c +++ b/dir.c @@ -1341,10 +1341,7 @@ static struct path_simplify *create_simplify(const char **pathspec) for (nr = 0 ; ; nr++) { const char *match; - if (nr = alloc) { - alloc = alloc_nr(alloc); - simplify = xrealloc(simplify, alloc * sizeof(*simplify)); - } + ALLOC_GROW(simplify, nr + 1, alloc); match = *pathspec++; if (!match) break; -- 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
[PATCH v2 11/11] attr.c: change handle_attr_line() to use ALLOC_GROW()
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- attr.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/attr.c b/attr.c index 8d13d70..734222d 100644 --- a/attr.c +++ b/attr.c @@ -338,12 +338,7 @@ static void handle_attr_line(struct attr_stack *res, a = parse_attr_line(line, src, lineno, macro_ok); if (!a) return; - if (res-alloc = res-num_matches) { - res-alloc = alloc_nr(res-num_matches); - res-attrs = xrealloc(res-attrs, - sizeof(struct match_attr *) * - res-alloc); - } + ALLOC_GROW(res-attrs, res-num_matches + 1, res-alloc); res-attrs[res-num_matches++] = a; } -- 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: [PATCH v2 00/11] Use ALLOC_GROW() instead of inline code
Michael, On 28.02.2014 18:38, Michael Haggerty wrote: Everything looks fine to me. Assuming the test suite ran 100%, Acked-by: Michael Haggerty mhag...@alum.mit.edu All tests passed successfully for this patch, at least on my machine. Can I do something else to improve this patch? -- 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] branch: change install_branch_config() to use skip_prefix()
Change install_branch_config() function to use skip_prefix() for getting short name of remote branch. Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- branch.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/branch.c b/branch.c index 723a36b..310749b 100644 --- a/branch.c +++ b/branch.c @@ -4,6 +4,8 @@ #include remote.h #include commit.h +static const char refs_heads_prefix[] = refs/heads/; + struct tracking { struct refspec spec; char *src; @@ -49,8 +51,8 @@ static int should_setup_rebase(const char *origin) void install_branch_config(int flag, const char *local, const char *origin, const char *remote) { - const char *shortname = remote + 11; - int remote_is_branch = starts_with(remote, refs/heads/); + const char *shortname = skip_prefix(remote, refs_heads_prefix); + int remote_is_branch = starts_with(remote, refs_heads_prefix); struct strbuf key = STRBUF_INIT; int rebasing = should_setup_rebase(origin); -- 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: [PATCH] branch: change install_branch_config() to use skip_prefix()
Michael, Thank you for your remarks. If you look at what skip_prefix() and starts_with() do, I think you will find that you are doing too much work here. How about this one? const char *shortname = skip_prefix(remote, refs/heads/); int remote_is_branch = shortname != NULL; -- 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] branch: change install_branch_config() to use skip_prefix()
Change install_branch_config() to use skip_prefix() for getting the short name of the remote branch. Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- branch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/branch.c b/branch.c index 723a36b..9382e02 100644 --- a/branch.c +++ b/branch.c @@ -49,8 +49,8 @@ static int should_setup_rebase(const char *origin) void install_branch_config(int flag, const char *local, const char *origin, const char *remote) { - const char *shortname = remote + 11; - int remote_is_branch = starts_with(remote, refs/heads/); + const char *shortname = skip_prefix(remote, refs/heads/); + int remote_is_branch = shortname != NULL; struct strbuf key = STRBUF_INIT; int rebasing = should_setup_rebase(origin); -- 1.8.3.2 -- 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 ALLOC_GROW() instead of inline code
Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@gmail.com --- attr.c | 7 +-- builtin/pack-objects.c | 7 +-- bundle.c | 6 +- cache-tree.c | 6 +- commit.c | 8 ++-- diff.c | 12 ++-- diffcore-rename.c | 12 ++-- dir.c | 5 + patch-ids.c| 5 + read-cache.c | 9 ++--- reflog-walk.c | 13 +++-- replace_object.c | 8 ++-- 12 files changed, 19 insertions(+), 79 deletions(-) diff --git a/attr.c b/attr.c index 8d13d70..734222d 100644 --- a/attr.c +++ b/attr.c @@ -338,12 +338,7 @@ static void handle_attr_line(struct attr_stack *res, a = parse_attr_line(line, src, lineno, macro_ok); if (!a) return; - if (res-alloc = res-num_matches) { - res-alloc = alloc_nr(res-num_matches); - res-attrs = xrealloc(res-attrs, - sizeof(struct match_attr *) * - res-alloc); - } + ALLOC_GROW(res-attrs, res-num_matches + 1, res-alloc); res-attrs[res-num_matches++] = a; } diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 541667f..92cbce8 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1156,12 +1156,7 @@ static int check_pbase_path(unsigned hash) if (0 = pos) return 1; pos = -pos - 1; - if (done_pbase_paths_alloc = done_pbase_paths_num) { - done_pbase_paths_alloc = alloc_nr(done_pbase_paths_alloc); - done_pbase_paths = xrealloc(done_pbase_paths, - done_pbase_paths_alloc * - sizeof(unsigned)); - } + ALLOC_GROW(done_pbase_paths, done_pbase_paths_num + 1, done_pbase_paths_alloc); done_pbase_paths_num++; if (pos done_pbase_paths_num) memmove(done_pbase_paths + pos + 1, diff --git a/bundle.c b/bundle.c index e99065c..1388a3e 100644 --- a/bundle.c +++ b/bundle.c @@ -14,11 +14,7 @@ static const char bundle_signature[] = # v2 git bundle\n; static void add_to_ref_list(const unsigned char *sha1, const char *name, struct ref_list *list) { - if (list-nr + 1 = list-alloc) { - list-alloc = alloc_nr(list-nr + 1); - list-list = xrealloc(list-list, - list-alloc * sizeof(list-list[0])); - } + ALLOC_GROW(list-list, list-nr + 1, list-alloc); memcpy(list-list[list-nr].sha1, sha1, 20); list-list[list-nr].name = xstrdup(name); list-nr++; diff --git a/cache-tree.c b/cache-tree.c index 0bbec43..30149d1 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -75,11 +75,7 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it, return NULL; pos = -pos-1; - if (it-subtree_alloc = it-subtree_nr) { - it-subtree_alloc = alloc_nr(it-subtree_alloc); - it-down = xrealloc(it-down, it-subtree_alloc * - sizeof(*it-down)); - } + ALLOC_GROW(it-down, it-subtree_nr + 1, it-subtree_alloc); it-subtree_nr++; down = xmalloc(sizeof(*down) + pathlen + 1); diff --git a/commit.c b/commit.c index 6bf4fe0..e004314 100644 --- a/commit.c +++ b/commit.c @@ -147,12 +147,8 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups) return 1; } pos = -pos - 1; - if (commit_graft_alloc = ++commit_graft_nr) { - commit_graft_alloc = alloc_nr(commit_graft_alloc); - commit_graft = xrealloc(commit_graft, - sizeof(*commit_graft) * - commit_graft_alloc); - } + ALLOC_GROW(commit_graft, commit_graft_nr + 1, commit_graft_alloc); + commit_graft_nr++; if (pos commit_graft_nr) memmove(commit_graft + pos + 1, commit_graft + pos, diff --git a/diff.c b/diff.c index 8e4a6a9..f5f0fd1 100644 --- a/diff.c +++ b/diff.c @@ -1361,11 +1361,7 @@ static struct diffstat_file *diffstat_add(struct diffstat_t *diffstat, { struct diffstat_file *x; x = xcalloc(sizeof (*x), 1); - if (diffstat-nr == diffstat-alloc) { - diffstat-alloc = alloc_nr(diffstat-alloc); - diffstat-files = xrealloc(diffstat-files, - diffstat-alloc * sizeof(x)); - } + ALLOC_GROW(diffstat-files, diffstat-nr + 1, diffstat-alloc); diffstat-files[diffstat-nr++] = x; if (name_b) { x-from_name = xstrdup(name_a); @@ -3965,11 +3961,7 @@ struct diff_queue_struct diff_queued_diff; void diff_q(struct diff_queue_struct *queue, struct diff_filepair *dp) { - if (queue-alloc = queue-nr
[PATCH] commit.c: use the generic sha1_pos function for lookup sha1
Refactor binary search in commit_graft_pos function: use generic sha1_pos function. Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- commit.c | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/commit.c b/commit.c index 6bf4fe0..8edaeb7 100644 --- a/commit.c +++ b/commit.c @@ -10,6 +10,7 @@ #include mergesort.h #include commit-slab.h #include prio-queue.h +#include sha1-lookup.h static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **); @@ -114,23 +115,16 @@ static unsigned long parse_commit_date(const char *buf, const char *tail) static struct commit_graft **commit_graft; static int commit_graft_alloc, commit_graft_nr; +static const unsigned char *commit_graft_sha1_access(size_t index, void *table) +{ + struct commit_graft **commit_graft_table = table; + return commit_graft_table[index]-sha1; +} + static int commit_graft_pos(const unsigned char *sha1) { - int lo, hi; - lo = 0; - hi = commit_graft_nr; - while (lo hi) { - int mi = (lo + hi) / 2; - struct commit_graft *graft = commit_graft[mi]; - int cmp = hashcmp(sha1, graft-sha1); - if (!cmp) - return mi; - if (cmp 0) - hi = mi; - else - lo = mi + 1; - } - return -lo - 1; + return sha1_pos(sha1, commit_graft, commit_graft_nr, + commit_graft_sha1_access); } int register_commit_graft(struct commit_graft *graft, int ignore_dups) -- 1.8.5.3
[PATCH v2] commit.c: use the generic sha1_pos function for lookup
Refactor binary search in commit_graft_pos function: use generic sha1_pos function. Signed-off-by: Dmitry S. Dolzhenko dmitrys.dolzhe...@yandex.ru --- commit.c | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/commit.c b/commit.c index 6bf4fe0..6ceee6a 100644 --- a/commit.c +++ b/commit.c @@ -10,6 +10,7 @@ #include mergesort.h #include commit-slab.h #include prio-queue.h +#include sha1-lookup.h static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **); @@ -114,23 +115,16 @@ static unsigned long parse_commit_date(const char *buf, const char *tail) static struct commit_graft **commit_graft; static int commit_graft_alloc, commit_graft_nr; +static const unsigned char *commit_graft_sha1_access(size_t index, void *table) +{ + struct commit_graft **commit_graft_table = table; + return commit_graft_table[index]-sha1; +} + static int commit_graft_pos(const unsigned char *sha1) { - int lo, hi; - lo = 0; - hi = commit_graft_nr; - while (lo hi) { - int mi = (lo + hi) / 2; - struct commit_graft *graft = commit_graft[mi]; - int cmp = hashcmp(sha1, graft-sha1); - if (!cmp) - return mi; - if (cmp 0) - hi = mi; - else - lo = mi + 1; - } - return -lo - 1; + return sha1_pos(sha1, commit_graft, commit_graft_nr, + commit_graft_sha1_access); } int register_commit_graft(struct commit_graft *graft, int ignore_dups) -- 1.8.3.2 -- 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] commit.c: use the generic sha1_pos function for lookup sha1
Thank you for your remarks. I'll try to fix my patch and send it again. -- 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 in GSoC 2014
Hi. I was just going to write an email about that I would like to participate in GSoC and contribute to Git project. I don't have wide experience in C programming, but I could be start as a janitor. I found several tasks here https://git.wiki.kernel.org/index.php/Janitor. For example Refactor binary search functions. If this task is actual, I could be to start from it. -- 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] init-db.c: honor case on case preserving fs
On Sat, Feb 1, 2014 at 1:14 PM, Reuben Hawkins reuben...@gmail.com wrote: Most case-insensitive filesystems are case-preserving. In these filesystems (such as HFS+ on OS X) you can name a file Filename.txt, then rename the file to FileName.txt. That file will be accessible by both filenames, but the case is otherwise honored. We don't want to have git ignore case on these case-preserving filesystem implementations. Actually, we want to ignore case on ANY case-insensitive file system whether it is a case-preserving or not. Let's suppose we have a central repository where Filename.txt is renamed as FileName.txt. Now a user pulls changes from that repository on Windows. With core.ignorecase = true, everything works perfectly: $ git pull remote: Counting objects: 3, done. remote: Total 2 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (2/2), done. From z:/shared/test2/ 3d885e6..ce5deef master - origin/master Updating 3d885e6..ce5deef Fast-forward Filename.txt = FileName.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Filename.txt = FileName.txt (100%) $ ls FileName.txt Now, if you try to do the same thing with core.ignorecase = false, you get this: $ git pull remote: Counting objects: 3, done. remote: Total 2 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (2/2), done. From z:/shared/test2/ 3d885e6..ce5deef master - origin/master Updating 3d885e6..ce5deef error: The following untracked working tree files would be overwritten by merge: FileName.txt Please move or remove them before you can merge. Aborting I have tested this with git version 1.8.3.msysgit.0, but I don't think it is any different with the latest version. This fixes a problem where if you import an hg repository, using git-remote-hg, Perhaps, it fixes that case, but it breaks a far more common case. So I believe that git-remote-hg should be corrected and not init-db.c Dmitry -- 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] init-db.c: honor case on case preserving fs
On 2/2/14, Reuben Hawkins reuben...@gmail.com wrote: This is a separate issue which core.ignorecase is sweeping under the rug. When you get this error message, do an 'ls' and you'll see there isn't an untracked file called 'FileName.txt'. There is, however, a tracked file called 'Filename.txt'. Because there aren't really any untracked files, the merge should be able to complete without overwriting anything. I am afraid but it is exactly the same issue, because it never happens on any case-sensitive system. IIRC, Git stats 'FileName.txt' to verify whether it exists or not, and the file system tells that this file exists, because it ignores case. So the option is called 'ignorecase'. No one meant this option to be about whether the file system preserves case or not, because Git does not care about it and assumes that on any case-insensitive filesystem, the right case is in the index, which is usually better, because otherwise people can often change filenames inadvertently. I don't know much about importers, but I have looked at the source code of fast-import.c and I do not see ignore_case there, though it may affect it indirectly through some functions that it uses. AFAIK, fast-import does not rely on the filesystem, it should always work with ignorecase=false. Dmitry -- 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: submodule update and core.askpass
BTW, a workaround is to pass a path to askpass script in the GIT_ASKPASS environment variable. Jens Lehmann jens.lehm...@web.de writes: Am 16.11.2013 22:42, schrieb Thomas Rast: Dmitry Neverov dmitry.neve...@jetbrains.com writes: git -c core.askpass=pass.sh clone main-repo cd main-repo git submodule init git submodule sync git -c core.askpass=pass.sh submodule update The last command asks for a password interactively. I've run bisect, it seems like it started failing from commit be8779f7ac9a3be9aa783df008d59082f4054f67. I've checked: submodule update works fine in 1.8.5.rc2 with removed call to clear_local_git_env. Aside from GIT_CONFIG_PARAMETERS, which this needs ... Yes, if I understand GIT_CONFIG_PARAMETERS correctly we should not clean it as the user explicitly asked us to use that setting. ..., I wonder if we should also let other variables pass through. For example, if the user went out of their way to set GIT_ALTERNATE_OBJECT_DIRECTORIES, shouldn't we also respect that? Hmm, I'm not so sure. Does the user really want the setting of GIT_ALTERNATE_OBJECT_DIRECTORIES to be honored inside the submodule too or would he want a different setting (including none)? I suspect different users would give different answers. And wouldn't a working GIT_CONFIG_PARAMETERS (or configuring the submodule after the initial clone) be the solution for that? The list of variables that is unset by clear_local_git_env is $(git rev-parse --local-env-vars), currently GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_CONFIG GIT_CONFIG_PARAMETERS GIT_OBJECT_DIRECTORY GIT_DIR GIT_WORK_TREE GIT_IMPLICIT_WORK_TREE GIT_GRAFT_FILE GIT_INDEX_FILE GIT_NO_REPLACE_OBJECTS GIT_PREFIX -- Dmitry Neverov JetBrains http://www.jetbrains.com Develop with pleasure! -- 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
submodule update and core.askpass
Hi, it seems like git submodule update command doesn't respect the core.askpass option specified in a command line. I have a repository with a submodule, I serve it over http which requires an authorization and both main repository and submodule require the same credentials. I run the following commands (pass.sh is a script which prints a password to stdout): git -c core.askpass=pass.sh clone main-repo cd main-repo git submodule init git submodule sync git -c core.askpass=pass.sh submodule update The last command asks for a password interactively. I've run bisect, it seems like it started failing from commit be8779f7ac9a3be9aa783df008d59082f4054f67. I've checked: submodule update works fine in 1.8.5.rc2 with removed call to clear_local_git_env. Is there any way to make git submodule update respect core.askpass option, so one can use it in scripts? -- Dmitry Neverov -- 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
[RFC] Documentation: --options in man-pages synopsys
Hi, I've noticed that man git-pack-objects describes cmdline as following SYNOPSYS 'git pack-objects' [-q | --progress | --all-progress] [--all-progress-implied] [--no-reuse-delta] [--delta-base-offset] [--non-empty] [--local] [--incremental] [--window=n] [--depth=n] [--revs [--unpacked | --all]] [--stdout | base-name] [--keep-true-parents] object-list while OPTIONS sections has even more options, --no-reuse-objects for instance. Should it be dealt with and how? - add smth like ... at the tail of options in synopsys to indicate that there are more options - add all the [--options] to synopsys - drop all the [--options] as they all are optional - pick only the most common/important ones like -q --progress, per command or per command classes (hard to maintain and/or verify?) -- 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] fast-import: always save out branches, tags and marks on checkpoint
checkpoint command causes fast-import to finish the current pack and start a new one. If there are no (newly imported) objects in the pack fast-import does nothing with the pack AND doesn't save out branches, tags and marks. Fix it by always saving out branches, tags and marks on a checkpoint. Simple test case where no new objects are created is $ fast-export $somebranch | sed $somebranch to $newbranch | fast-import While it's running send checkpoint signals to fast-import to avoid parsing the import stream. Non-fast-forward updates may happen if there are merges in $somebranch history. The fast-import may fail on checkpoints now. Not a regression as it'd fail the same way before if import is to a new/empty repository - the intermediate packs won't be empty and so a real checkpoint happens anyway. Whether fast-export really should reuse $somebranch name for all commits in it's history graph and so cause intermediate non-fast-forwads is a separate topic to be discussed. Signed-off-by: Dmitry Ivankov divanor...@gmail.com --- fast-import.c | 9 - t/t9300-fast-import.sh | 26 ++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/fast-import.c b/fast-import.c index f4d9969..4a3b93f 100644 --- a/fast-import.c +++ b/fast-import.c @@ -3101,12 +3101,11 @@ static void parse_ls(struct branch *b) static void checkpoint(void) { checkpoint_requested = 0; - if (object_count) { + if (object_count) cycle_packfile(); - dump_branches(); - dump_tags(); - dump_marks(); - } + dump_branches(); + dump_tags(); + dump_marks(); } static void parse_checkpoint(void) diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 88fc407..03bfdef 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -693,6 +693,32 @@ test_expect_success \ 'git cat-file commit other actual test_cmp expect actual' +cat input2 INPUT_END +reset refs/heads/branch2 +from refs/heads/other + +reset refs/heads/branch2 +from refs/heads/branch +INPUT_END + +cat input3 INPUT_END +reset refs/heads/branch3 +from refs/heads/other + +checkpoint + +reset refs/heads/branch3 +from refs/heads/branch +INPUT_END + +test_expect_success \ + 'F: intermediate non-fast-forward' \ + 'git fast-import input2' + +test_expect_success \ + 'F: intermediate non-fast-forward with zero objects checkpoint should fail' \ + 'test_must_fail git fast-import input3' + ### ### series G ### -- 1.8.1.5 -- 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 for the Windows 1.8.3, GIT Bash icon issue
There is a standard command prompt icon in taskbar for GIT Bash instead of GIT icon Steps to reproduce: Select Taskbar Properties, Taskbar buttons, set to Never combine Run GIT Bash Best regards, Dmitry Kuzminov -- 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 for the Windows 1.8.3, GIT Bash icon issue
Philip, Yes, this is msysgit, version 1.8.3. Now I switched back to 1.7.11 -- there is no such issue in this older version. 09.08.2013, 22:31, Philip Oakley philipoak...@iee.org: From: Dmitry Kuzminov dkuzmi...@yandex-team.ru Dmitry, The Git for Windows development list is at msys...@googlegroups.com. Is this git for Windows or one of the other git versions on windows, and their installers? There is a standard command prompt icon in taskbar for GIT Bash instead of GIT icon Steps to reproduce: Select Taskbar Properties, Taskbar buttons, set to Never combine Run GIT Bash Best regards, Dmitry Kuzminov -- -- 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: [RFC/PATCH v2 1/1] cygwin: Add fast_lstat() and fast_fstat() functions
On Tue, Jul 16, 2013 at 7:54 AM, Mark Levedahl mleved...@gmail.com wrote: I see no difference in the above. (Yes, I checked multiple times that I was using different executables). Are you sure that you set core.filemode to false before testing? If you have core.filemode set to true then you _always_ use Cygwin stat, so it does not make any difference for you. Dmitry -- 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] contrib/git-subtree: Use /bin/sh interpreter instead of /bin/bash
Use /bin/sh interpreter instead of /bin/bash for contrib/git-subtree: it's required for systems which don't use bash by default (for example, FreeBSD), while there seem to be no bashisms in the script (confirmed by looking through the source and tesing subtree functionality with FreeBSD's /bin/sh) to require specifically bash and not the generic posix shell. Signed-off-by: Dmitry Marakasov amd...@amdmi3.ru --- contrib/subtree/git-subtree.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 8a23f58..5701376 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # git-subtree.sh: split/join git repositories in subdirectories of this one # -- 1.8.2.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
Textconv
Hello! Most of GUI for Git using 'git show' command to show differences between versions. For example: WebStorm IDE. But for now there is no way to specify text conversion command in git config for 'show' as it done for 'diff'. It makes problems when we dealing with encrypted repositories. Is there any alternative way to configure git repository? Or if it impossible will you implement such kind of feature? -- 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: Textconv
I mean that our filter doesn't work with 'git show' and I need to enable it for this command. This is part of my git config file: [filter openssl] smudge = openssl enc -d -base64 -aes-256-ecb -k 'abcde' 2 /dev/null || cat clean = openssl enc -base64 -aes-256-ecb -S '12345' -k 'abcde' [diff openssl] textconv = openssl enc -d -base64 -aes-256-ecb -k 'abcde' -in $1 2 /dev/null || cat $1 [merge] renormalize = true And content of '.git/info/attributes': * filter=openssl diff=openssl How can I deal with it? On 03/11/2013 02:00 PM, Matthieu Moy wrote: Dmitry Ilin dmi...@mylovecompany.com writes: Hello! Most of GUI for Git using 'git show' command to show differences between versions. For example: WebStorm IDE. But for now there is no way to specify text conversion command in git config for 'show' as it done for 'diff'. Do you mean, to enable it, or to disable it? By default, git show does use the textconv filter to compute the diff, at least if you specified the textconv driver in your .gitattributes file. -- 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: Textconv
I tried this command and I got following result: trace: built-in: git 'show' 'a1bffde' trace: run_command: 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' 2 /dev/null || cat' trace: exec: 'sh' '-c' 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' 2 /dev/null || cat' 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' 2 /dev/null || cat' trace: run_command: 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' -in $1 2 /dev/null || cat $1' '/tmp/CLPGPk_config.js' trace: exec: 'sh' '-c' 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' -in $1 2 /dev/null || cat $1 $@' 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' -in $1 2 /dev/null || cat $1' '/tmp/CLPGPk_config.js' trace: run_command: 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' 2 /dev/null || cat' trace: exec: 'sh' '-c' 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' 2 /dev/null || cat' 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' 2 /dev/null || cat' trace: run_command: 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' -in $1 2 /dev/null || cat $1' '/tmp/Uyc2Dj_config.js' trace: exec: 'sh' '-c' 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' -in $1 2 /dev/null || cat $1 $@' 'openssl enc -d -base64 -aes-256-ecb -k '\''abcde'\'' -in $1 2 /dev/null || cat $1' '/tmp/Uyc2Dj_config.js' diff --git a/path/config.js b/path/config.js index c4ad2d4..a67d13f 100644 --- a/path/config.js +++ b/path/config.js And also not encrypted data of my commit. On 03/11/2013 02:41 PM, Matthieu Moy wrote: Dmitry Ilin dmi...@mylovecompany.com writes: I mean that our filter doesn't work with 'git show' and I need to enable it for this command. This is part of my git config file: [filter openssl] smudge = openssl enc -d -base64 -aes-256-ecb -k 'abcde' 2 /dev/null || cat clean = openssl enc -base64 -aes-256-ecb -S '12345' -k 'abcde' [diff openssl] textconv = openssl enc -d -base64 -aes-256-ecb -k 'abcde' -in $1 2 /dev/null || cat $1 [merge] renormalize = true Maybe a bad interaction between the [filter ...] section and the [textconv ...] one. Can you run: GIT_TRACE=true git show some-relevant-commit to see what's going on? -- 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] am: invoke perl's strftime in C locale
On Fri, Jan 18, 2013 at 12:36:46PM -0800, Junio C Hamano wrote: Dmitry V. Levin l...@altlinux.org writes: This fixes hg patch format support for locales other than C and en_*. Before the change, git-am was making Date: line from hg changeset metadata according to the current locale, and this line was rejected later with invalid date format diagnostics because localized date strings are not supported. Reported-by: Gleb Fotengauer-Malinovskiy gle...@altlinux.org Signed-off-by: Dmitry V. Levin l...@altlinux.org --- v3: alternative implementation using setlocale(LC_TIME, C) git-am.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index c682d34..8677d8c 100755 --- a/git-am.sh +++ b/git-am.sh @@ -334,7 +334,8 @@ split_patches () { # Since we cannot guarantee that the commit message is in # git-friendly format, we put no Subject: line and just consume # all of the message as the body - perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 } + perl -M'POSIX qw(strftime :locale_h)' -ne ' + BEGIN { setlocale(LC_TIME, C); $subject = 0 } I still haven't convinced myself that this is an improvement over the simple LC_ALL=C LANG=C perl ... approach. Personally I prefer 2nd edition that is simpler and does the right thing (not that LC_ALL=C is necessary and sufficient, you neither need to add things like LANG=C nor can relax it to LC_TIME=C). -- ldv pgp3AH6oqBPnI.pgp Description: PGP signature
Re: [PATCH] am: invoke perl's strftime in C locale
On Tue, Jan 15, 2013 at 08:50:59AM -0800, Jeff King wrote: On Tue, Jan 15, 2013 at 05:42:12PM +0100, Antoine Pelisse wrote: This puts all of perl into the C locale, which would mean error messages from perl would be in English rather than the user's language. It probably isn't a big deal, because that snippet of perl is short and not likely to produce problems, but I wonder how hard it would be to set the locale just for the strftime call. Maybe just setting LC_TIME to C would do ... Yeah, that is a nice simple solution. Dmitry, does just setting LC_TIME fix the problem for you? Just setting LC_TIME environment variable instead of LC_ALL would end up with unreliable solution because LC_ALL has the highest priority. If keeping error messages from perl has the utmost importance, it could be achieved by - perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 } + perl -M'POSIX qw(strftime :locale_h)' -ne ' + BEGIN { setlocale(LC_TIME, C); $subject = 0 } but the little perl helper script we are talking about hardly worths so much efforts. -- ldv pgp6E64QU8Sck.pgp Description: PGP signature
[PATCH v3] am: invoke perl's strftime in C locale
This fixes hg patch format support for locales other than C and en_*. Before the change, git-am was making Date: line from hg changeset metadata according to the current locale, and this line was rejected later with invalid date format diagnostics because localized date strings are not supported. Reported-by: Gleb Fotengauer-Malinovskiy gle...@altlinux.org Signed-off-by: Dmitry V. Levin l...@altlinux.org --- v3: alternative implementation using setlocale(LC_TIME, C) git-am.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index c682d34..8677d8c 100755 --- a/git-am.sh +++ b/git-am.sh @@ -334,7 +334,8 @@ split_patches () { # Since we cannot guarantee that the commit message is in # git-friendly format, we put no Subject: line and just consume # all of the message as the body - perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 } + perl -M'POSIX qw(strftime :locale_h)' -ne ' + BEGIN { setlocale(LC_TIME, C); $subject = 0 } if ($subject) { print ; } elsif (/^\# User /) { s/\# User/From:/ ; print ; } elsif (/^\# Date /) { -- ldv -- 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] am: invoke perl's strftime in C locale
This fixes hg patch format support for locales other than C and en_*. Before the change, git-am was making Date: line from hg changeset metadata according to the current locale, and this line was rejected later with invalid date format diagnostics because localized date strings are not supported. Reported-by: Gleb Fotengauer-Malinovskiy gle...@altlinux.org Signed-off-by: Dmitry V. Levin l...@altlinux.org --- v2: replaced unfriendly URL with a short description git-am.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index c682d34..64b88e4 100755 --- a/git-am.sh +++ b/git-am.sh @@ -334,7 +334,7 @@ split_patches () { # Since we cannot guarantee that the commit message is in # git-friendly format, we put no Subject: line and just consume # all of the message as the body - perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 } + LC_ALL=C perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 } if ($subject) { print ; } elsif (/^\# User /) { s/\# User/From:/ ; print ; } elsif (/^\# Date /) { -- ldv -- 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