[PATCH 0/3] lazily load commit-buffer

2013-01-26 Thread Jeff King
On Fri, Jan 25, 2013 at 07:36:18AM -0800, Junio C Hamano wrote: Jonathon Mah j...@me.com writes: Just to note, the proposals so far don't prevent a smart-ass function from freeing the buffer when it's called underneath the use/release scope, as in: with_commit_buffer(commit); {

[PATCH 1/3] commit: drop useless xstrdup of commit message

2013-01-26 Thread Jeff King
When git-commit is asked to reuse a commit message via -c, we call read_commit_message, which looks up the commit and hands back either the re-encoded result, or a copy of the original. We make a copy in the latter case so that the ownership semantics of the return value are clear (in either case,

[PATCH 3/3] logmsg_reencode: lazily load missing commit buffers

2013-01-26 Thread Jeff King
Usually a commit that makes it to logmsg_reencode will have been parsed, and the commit-buffer struct member will be valid. However, some code paths will free commit buffers after having used them (for example, the log traversal machinery will do so to keep memory usage down). Most of the time

Re: git merge error question: The following untracked working tree files would be overwritten by merge

2013-01-26 Thread Carsten Fuchs
Am 2013-01-25 19:07, schrieb Junio C Hamano: Carsten Fuchs carsten.fu...@cafu.de writes: [...] $ git merge origin/master --ff-only Updating f419d57..2da6052 error: The following untracked working tree files would be overwritten by merge: obsolete/e107/Readme.txt

[PATCH 1/2 v2] mergetool--lib: don't call exit in setup_tool

2013-01-26 Thread John Keeping
This will make it easier to use setup_tool in places where we expect that the selected tool will not support the current mode. Signed-off-by: John Keeping j...@keeping.me.uk --- On Fri, Jan 25, 2013 at 04:24:03PM -0800, Junio C Hamano wrote: Applying this one on top of 1/7 thru 5/7 and 7/7 seems

Re: [PATCH] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread John Keeping
On Fri, Jan 25, 2013 at 10:50:58PM -0800, David Aguilar wrote: Remove the exceptions for vim and defaults in the mergetool library so that every filename in mergetools/ matches 1:1 with the name of a valid built-in tool. Make common functions available in $MERGE_TOOLS_DIR/include/.

Re: [PATCH 1/2] git-p4.py: support Python 2.5

2013-01-26 Thread Pete Wyckoff
draf...@gmail.com wrote on Fri, 25 Jan 2013 12:44 -0800: Python 2.5 and older do not accept None as the first argument to translate() and complain with: TypeError: expected a character buffer object Satisfy this older python by calling maketrans() to generate an empty translation table

Re: [PATCH 2/2] git-p4.py: support Python 2.4

2013-01-26 Thread Pete Wyckoff
draf...@gmail.com wrote on Fri, 25 Jan 2013 12:44 -0800: Python 2.4 lacks the following features: subprocess.check_call struct.pack_into Take a cue from 460d1026 and provide an implementation of the CalledProcessError exception. Then replace the calls to subproccess.check_call

[PATCH 1/2 v3] mergetool--lib: don't call exit in setup_tool

2013-01-26 Thread John Keeping
This will make it easier to use setup_tool in places where we expect that the selected tool will not support the current mode. We need to introduce a new return code for setup_tool to differentiate between the case of the selected tool is invalid and the selected tool is not a built-in since we

Re: [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

2013-01-26 Thread Mark Levedahl
On 01/25/2013 08:03 PM, Jonathan Nieder wrote: diff --git a/abspath.c b/abspath.c index 40cdc462..c7d5458e 100644 --- a/abspath.c +++ b/abspath.c @@ -216,7 +216,7 @@ const char *absolute_path(const char *path) const char *prefix_filename(const char *pfx, int pfx_len, const char *arg) {

Re: [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

2013-01-26 Thread Torsten Bögershausen
On 26.01.13 02:03, Jonathan Nieder wrote: Throughout git, it is assumed that the WIN32 preprocessor symbol is defined on native Windows setups (mingw and msvc) and not on Cygwin. On Cygwin, most of the time git can pretend this is just another Unix machine, and Windows-specific magic is

Re: [PATCH 1/2] git-p4.py: support Python 2.5

2013-01-26 Thread Brandon Casey
On Sat, Jan 26, 2013 at 4:45 AM, Pete Wyckoff p...@padd.com wrote: draf...@gmail.com wrote on Fri, 25 Jan 2013 12:44 -0800: Python 2.5 and older do not accept None as the first argument to translate() and complain with: TypeError: expected a character buffer object Satisfy this older

Port 22

2013-01-26 Thread Craig Christensen
I am currently a student at Brigham Young University - Idaho and we are use Pagoda Box and Git for our Mobile Apps class. However, the school's network has blocked incoming trafic on port 22. I have been searching through all the tutorials and documents provided by Pagoda Box and Git but have

Re: [PATCH 2/2] git-p4.py: support Python 2.4

2013-01-26 Thread Brandon Casey
On Sat, Jan 26, 2013 at 4:48 AM, Pete Wyckoff p...@padd.com wrote: draf...@gmail.com wrote on Fri, 25 Jan 2013 12:44 -0800: + sys.stdout.write(s); One stray semicolon. Whoops. Thanks. In terms of maintenance, I'll not run tests with 2.4 or 2.5 myself, but maybe you would be willing

[PATCH v2 2/2] git-p4.py: support Python 2.4

2013-01-26 Thread Brandon Casey
From: Brandon Casey draf...@gmail.com Python 2.4 lacks the following features: subprocess.check_call struct.pack_into Take a cue from 460d1026 and provide an implementation of the CalledProcessError exception. Then replace the calls to subproccess.check_call with calls to subprocess.call

[PATCH v2 1/2] git-p4.py: support Python 2.5

2013-01-26 Thread Brandon Casey
From: Brandon Casey draf...@gmail.com Python 2.5 and older do not accept None as the first argument to translate() and complain with: TypeError: expected a character buffer object As suggested by Pete Wyckoff, let's just replace the call to translate() with a regex search which should be

Re: [PATCH] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread David Aguilar
On Sat, Jan 26, 2013 at 4:12 AM, John Keeping j...@keeping.me.uk wrote: On Fri, Jan 25, 2013 at 10:50:58PM -0800, David Aguilar wrote: Remove the exceptions for vim and defaults in the mergetool library so that every filename in mergetools/ matches 1:1 with the name of a valid built-in tool.

Re: [PATCH] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread John Keeping
On Sat, Jan 26, 2013 at 12:40:23PM -0800, David Aguilar wrote: On Sat, Jan 26, 2013 at 4:12 AM, John Keeping j...@keeping.me.uk wrote: On Fri, Jan 25, 2013 at 10:50:58PM -0800, David Aguilar wrote: diff --git a/Makefile b/Makefile index f69979e..3bc6eb5 100644 --- a/Makefile +++

Re: [PATCH 0/3] lazily load commit-buffer

2013-01-26 Thread Junio C Hamano
Jeff King p...@peff.net writes: Yeah, agreed. I started to fix this up with a use/unuse pattern and realized something: all of the call sites are calling logmsg_reencode anyway, because that is the next logical step in doing anything with the buffer that is not just parsing out the

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-26 Thread Junio C Hamano
Torsten Bögershausen tbo...@web.de writes: Do we really need which to detect if frotz is installed? I think we all know the answer to that question is no, but why is that a relevant question in the context of this discussion? One of us may be very confused. I thought the topic of this

Re: [PATCH v3 6/8] git-remote-testpy: hash bytes explicitly

2013-01-26 Thread Junio C Hamano
John Keeping j...@keeping.me.uk writes: Junio, can you replace the queued 0846b0c (git-remote-testpy: hash bytes explicitly) with this? I hadn't realised that the hex encoding we chose before is a bytes to bytes encoding so it just fails with an error on Python 3 in the same way as the

Re: [PATCH 0/3] lazily load commit-buffer

2013-01-26 Thread Jeff King
On Sat, Jan 26, 2013 at 01:26:53PM -0800, Junio C Hamano wrote: This looks very good. I wonder if this lets us get rid of the hack in cmd_log_walk() that does this: while ((commit = get_revision(rev)) != NULL) { if (!log_tree_commit(rev, commit)

[PATCH 1/2] fetch: run gc --auto after fetching

2013-01-26 Thread Jeff King
We generally try to run gc --auto after any commands that might introduce a large number of new objects. An obvious place to do so is after running fetch, which may introduce new loose objects or packs (depending on the size of the fetch). While an active developer repository will probably

[PATCH 2/2] fetch-pack: avoid repeatedly re-scanning pack directory

2013-01-26 Thread Jeff King
When we look up a sha1 object for reading, we first check packfiles, and then loose objects. If we still haven't found it, we re-scan the list of packfiles in `objects/pack`. This final step ensures that we can co-exist with a simultaneous repack process which creates a new pack and then prunes

[PATCH] git-remote-testpy: fix patch hashing on Python 3

2013-01-26 Thread John Keeping
When this change was originally made (0846b0c - git-remote-testpy: hash bytes explicitly , I didn't realised that the hex encoding we chose is a bytes to bytes encoding so it just fails with an error on Python 3 in the same way as the original code. Since we want to convert a Unicode string to

[PATCH 1/2] mergetool--lib: don't call exit in setup_tool

2013-01-26 Thread David Aguilar
From: John Keeping j...@keeping.me.uk This will make it easier to use setup_tool in places where we expect that the selected tool will not support the current mode. We need to introduce a new return code for setup_tool to differentiate between the case of the selected tool is invalid and the

Re: [PATCH 1/2] fetch: run gc --auto after fetching

2013-01-26 Thread Jonathan Nieder
Jeff King wrote: --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -959,6 +959,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) struct string_list list = STRING_LIST_INIT_NODUP; struct remote *remote; int result = 0; + static const char

Re: [PATCH 06/21] git p4 test: use client_view in t9806

2013-01-26 Thread Pete Wyckoff
Yes, this really is four months later. Somehow I forgot all about this series. gits...@pobox.com wrote on Fri, 28 Sep 2012 12:11 -0700: Pete Wyckoff p...@padd.com writes: Use the standard client_view function from lib-git-p4.sh instead of building one by hand. This requires a bit of

[PATCHv2 00/21] git p4: work on cygwin

2013-01-26 Thread Pete Wyckoff
Junio and Hannes: thanks for the comments four months ago; I've been slow getting back to this. I incorporated all your suggestions. Junio: this merges okay with Brandon's v2.4 support series. This series fixes problems in git-p4, and its tests, so that git-p4 works on the cygwin platform.

[PATCHv2 01/21] git p4: temp branch name should use / even on windows

2013-01-26 Thread Pete Wyckoff
Commit fed2369 (git-p4: Search for parent commit on branch creation, 2012-01-25) uses temporary branches to help find the parent of a new p4 branch. The temp branches are of the form git-p4-tmp/%d for some p4 change number. Mistakenly, this string was made using os.path.join() instead of just

[PATCHv2 02/21] git p4: remove unused imports

2013-01-26 Thread Pete Wyckoff
Found by pyflakes checker tool. Modules shelve, getopt were unused. Module os.path is exported by os. Reformat one-per-line as is PEP008 suggested style. Signed-off-by: Pete Wyckoff p...@padd.com --- git-p4.py | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git

[PATCHv2 03/21] git p4: generate better error message for bad depot path

2013-01-26 Thread Pete Wyckoff
Depot paths must start with //. Exit with a better explanation when a bad depot path is supplied. Signed-off-by: Pete Wyckoff p...@padd.com --- git-p4.py | 1 + t/t9800-git-p4-basic.sh | 5 + 2 files changed, 6 insertions(+) diff --git a/git-p4.py b/git-p4.py index

[PATCHv2 04/21] git p4 test: use client_view to build the initial client

2013-01-26 Thread Pete Wyckoff
Simplify the code a bit by using an existing function. Signed-off-by: Pete Wyckoff p...@padd.com --- t/lib-git-p4.sh | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh index 7061dce..890ee60 100644 --- a/t/lib-git-p4.sh +++

[PATCHv2 05/21] git p4 test: avoid loop in client_view

2013-01-26 Thread Pete Wyckoff
The printf command re-interprets the format string as long as there are arguments to consume. Use this to simplify a for loop in the client_view() library function. This requires a fix to one of the client_view callers. An errant \n in the string was converted into a harmless newline in the

[PATCHv2 06/21] git p4 test: use client_view in t9806

2013-01-26 Thread Pete Wyckoff
Use the standard client_view function from lib-git-p4.sh instead of building one by hand. This requires a bit of rework, using the current value of $P4CLIENT for the client name. It also reorganizes the test to isolate changes to $P4CLIENT and $cli in a subshell. Signed-off-by: Pete Wyckoff

[PATCHv2 07/21] git p4 test: start p4d inside its db dir

2013-01-26 Thread Pete Wyckoff
This will avoid having to do native path conversion for windows. Also may be a bit cleaner always to know that p4d has that working directory, instead of wherever the function was called from. Signed-off-by: Pete Wyckoff p...@padd.com --- t/lib-git-p4.sh | 7 +-- 1 file changed, 5

[PATCHv2 08/21] git p4 test: translate windows paths for cygwin

2013-01-26 Thread Pete Wyckoff
Native windows binaries do not understand posix-like path mapping offered by cygwin. Convert paths to native using cygpath --windows before presenting them to p4d. This is done using the AltRoots mechanism of p4. Both the posix and windows forms are put in the client specification, allowing p4

[PATCHv2 09/21] git p4: remove unreachable windows \r\n conversion code

2013-01-26 Thread Pete Wyckoff
Replacing \r\n with \n on windows was added in c1f9197 (Replace \r\n with \n when importing from p4 on Windows, 2007-05-24), to work around an oddity with p4 print on windows. Text files are printed with \r\r\n endings, regardless of whether they were created on unix or windows, and regardless of

[PATCHv2 10/21] git p4: scrub crlf for utf16 files on windows

2013-01-26 Thread Pete Wyckoff
Files of type utf16 are handled with p4 print instead of the normal p4 -G print interface due to how the latter does not produce correct output. See 55aa571 (git-p4: handle utf16 filetype properly, 2011-09-17) for details. On windows, though, p4 print can not be told which line endings to use,

[PATCHv2 11/21] git p4 test: newline handling

2013-01-26 Thread Pete Wyckoff
P4 stores newlines in the depos as \n. By default, git does this too, both on unix and windows. Test to make sure that this stays true. Both git and p4 have mechanisms to use \r\n in the working directory. Exercise these. Signed-off-by: Pete Wyckoff p...@padd.com ---

Re: [PATCH v3 2/2] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread Junio C Hamano
David Aguilar dav...@gmail.com writes: @@ -44,19 +46,9 @@ valid_tool () { } setup_tool () { - case $1 in - vim*|gvim*) - tool=vim - ;; - *) - tool=$1 - ;; - esac This part was an eyesore every time I looked at

[PATCHv2 12/21] git p4 test: use LineEnd unix in windows tests too

2013-01-26 Thread Pete Wyckoff
In all clients, even those created on windows, use unix line endings. This makes it possible to verify file contents without doing OS-specific comparisons in all the tests. Tests in t9802-git-p4-filetype.sh are used to make sure that the other LineEnd options continue to work. Signed-off-by:

[PATCHv2 13/21] git p4 test: avoid wildcard * in windows

2013-01-26 Thread Pete Wyckoff
This character is not valid in windows filenames, even though it can appear in p4 depot paths. Avoid using it in tests on windows, both mingw and cygwin. Signed-off-by: Pete Wyckoff p...@padd.com --- t/t9809-git-p4-client-view.sh | 10 -- t/t9812-git-p4-wildcards.sh | 37

[PATCHv2 14/21] git p4: cygwin p4 client does not mark read-only

2013-01-26 Thread Pete Wyckoff
There are some old versions of p4, compiled for cygwin, that treat read-only files differently. Normally, a file that is not open is read-only, meaning that test -w on the file is false. This works on unix, and it works on windows using the NT version of p4. The cygwin version of p4, though,

[PATCHv2 15/21] git p4 test: use test_chmod for cygwin

2013-01-26 Thread Pete Wyckoff
This test does a commit that is a pure mode change, submits it to p4 but causes the submit to fail. It verifies that the state in p4 as well as the client directory are both unmodified after the failed submit. On cygwin, chmod +x does nothing, so use the test_chmod function to modify the index

[PATCHv2 16/21] git p4: disable read-only attribute before deleting

2013-01-26 Thread Pete Wyckoff
On windows, p4 marks un-edited files as read-only. Not only are they read-only, but also they cannot be deleted. Remove the read-only attribute before deleting in both the copy and rename cases. This also happens in the RCS cleanup code, where a file is marked to be deleted, but must first be

[PATCHv2 17/21] git p4: avoid shell when mapping users

2013-01-26 Thread Pete Wyckoff
The extra quoting and double-% are unneeded, just to work around the shell. Instead, avoid the shell indirection. Signed-off-by: Pete Wyckoff p...@padd.com --- git-p4.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-p4.py b/git-p4.py index a989704..c43d044 100755 ---

[PATCHv2 18/21] git p4: avoid shell when invoking git rev-list

2013-01-26 Thread Pete Wyckoff
Invoke git rev-list directly, avoiding the shell, in P4Submit and P4Sync. The overhead of starting extra processes is significant in cygwin; this speeds things up on that platform. Signed-off-by: Pete Wyckoff p...@padd.com --- git-p4.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)

[PATCHv2 19/21] git p4: avoid shell when invoking git config --get-all

2013-01-26 Thread Pete Wyckoff
Signed-off-by: Pete Wyckoff p...@padd.com --- git-p4.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-p4.py b/git-p4.py index c8ae83d..7efa9a8 100755 --- a/git-p4.py +++ b/git-p4.py @@ -571,7 +571,8 @@ def gitConfig(key, args = None): # set args to --bool, for

[PATCHv2 20/21] git p4: avoid shell when calling git config

2013-01-26 Thread Pete Wyckoff
Signed-off-by: Pete Wyckoff p...@padd.com --- git-p4.py | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/git-p4.py b/git-p4.py index 7efa9a8..ff3e8c9 100755 --- a/git-p4.py +++ b/git-p4.py @@ -560,13 +560,16 @@ def gitBranchExists(branch): return

[PATCHv2 21/21] git p4: introduce gitConfigBool

2013-01-26 Thread Pete Wyckoff
Make the intent of --bool more obvious by returning a direct True or False value. Convert a couple non-bool users with obvious bool intent. Signed-off-by: Pete Wyckoff p...@padd.com --- git-p4.py | 45 ++--- 1 file changed, 26 insertions(+), 19

Re: [PATCH v3 2/2] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread David Aguilar
On Sat, Jan 26, 2013 at 7:15 PM, Junio C Hamano gits...@pobox.com wrote: David Aguilar dav...@gmail.com writes: @@ -44,19 +46,9 @@ valid_tool () { } setup_tool () { - case $1 in - vim*|gvim*) - tool=vim - ;; - *) - tool=$1 -

Re: [PATCH v3 6/8] git-remote-testpy: hash bytes explicitly

2013-01-26 Thread Michael Haggerty
On 01/26/2013 10:44 PM, Junio C Hamano wrote: John Keeping j...@keeping.me.uk writes: Junio, can you replace the queued 0846b0c (git-remote-testpy: hash bytes explicitly) with this? I hadn't realised that the hex encoding we chose before is a bytes to bytes encoding so it just fails with

Re: [PATCH] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread Junio C Hamano
John Keeping j...@keeping.me.uk writes: I'm not sure creating an 'include' directory actually buys us much over declaring that 'vimdiff' is the real script and the others just source it. Is 'include' really used for such a purpose? It only houses defaults.sh as far as I can see. As that

Re: [PATCH] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread David Aguilar
On Sat, Jan 26, 2013 at 8:57 PM, Junio C Hamano gits...@pobox.com wrote: John Keeping j...@keeping.me.uk writes: I'm not sure creating an 'include' directory actually buys us much over declaring that 'vimdiff' is the real script and the others just source it. Is 'include' really used for

Re: [PATCH v3 6/8] git-remote-testpy: hash bytes explicitly

2013-01-26 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes: This will still fail under Python 2.x if repo.path is a byte string that contains non-ASCII characters. And it will fail under Python 3.1 and later if repo.path contains characters using the surrogateescape encoding option [1],... Here you don't

Re: [PATCH v3 6/8] git-remote-testpy: hash bytes explicitly

2013-01-26 Thread Sverre Rabbelier
On Sat, Jan 26, 2013 at 8:44 PM, Michael Haggerty mhag...@alum.mit.edu wrote: So to handle all of the cases across Python versions as closely as possible to the old 2.x code, it might be necessary to make the code explicitly depend on the Python version number, like: Does this all go away if

Re: [PATCH 0/3] lazily load commit-buffer

2013-01-26 Thread Junio C Hamano
Jeff King p...@peff.net writes: My HEAD has about 400/3000 non-unique commits, which matches your numbers percentage-wise. Dropping the lines above (and always freeing) takes my best-of-five for git log -g from 0.085s to 0.080s. Which is well within the noise. Doing git log -g Makefile ended

Re: [PATCH] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread David Aguilar
On Sat, Jan 26, 2013 at 9:07 PM, David Aguilar dav...@gmail.com wrote: On Sat, Jan 26, 2013 at 8:57 PM, Junio C Hamano gits...@pobox.com wrote: John Keeping j...@keeping.me.uk writes: I'm not sure creating an 'include' directory actually buys us much over declaring that 'vimdiff' is the real

Re: [PATCH] mergetools: Simplify how we handle vim and defaults

2013-01-26 Thread Junio C Hamano
David Aguilar dav...@gmail.com writes: I think that's much better. Would you like me to put this together into a proper patch? You can also squash it in (along with a removal of the last line of the commit message) if you prefer. I was lazy and didn't want to think about rewriting your log

Re: [PATCH 0/2] optimizing pack access on read only fetch repos

2013-01-26 Thread Junio C Hamano
Jeff King p...@peff.net writes: This is a repost from here: http://thread.gmane.org/gmane.comp.version-control.git/211176 which got no response initially. Basically the issue is that read-only repos (e.g., a CI server) whose workflow is something like: git fetch $some_branch git

[PATCH v2] Reduce false positive in check-non-portable-shell.pl

2013-01-26 Thread Torsten Bögershausen
check-non-portable-shell.pl is using simple regular expressions to find illegal shell syntax. Improve the expressions and reduce the chance for false positves: sed -i must be followed by 1..n whitespace and 1 non whitespace declare must be followed by 1..n whitespace and 1 non whitespace echo -n