[PATCH v2 2/2] bisect: make bisection refs per-worktree

2015-08-10 Thread David Turner
Using the new refs/worktree/ refs, make bisection per-worktree. Signed-off-by: David Turner dtur...@twopensource.com --- Documentation/git-bisect.txt | 4 ++-- Documentation/rev-list-options.txt | 14 +++--- bisect.c | 2 +- builtin/rev-parse.c

[PATCH v2 1/2] refs: refs/worktree/* become per-worktree

2015-08-10 Thread David Turner
We need a place to stick refs for bisects in progress that is not shared between worktrees. So we use the refs/worktree/ hierarchy. The is_per_worktree_ref function and associated docs learn that refs/worktree/ is per-worktree, as does the git_path code in path.c The ref-packing functions learn

[PATCH v5 0/5] Improve guessing of repository names

2015-08-10 Thread Patrick Steinhardt
This is version 5 of my patch series which aims to improve guessed directory names in several cases. This version now includes the patches from Jeff which were previously a separate patch series. Besides fixing behavior when cloning a repository with trailing '.git' suffix they also add a new

[PATCH v5 3/5] clone: do not include authentication data in guessed dir

2015-08-10 Thread Patrick Steinhardt
If the URI contains authentication data and the URI's path component is empty we fail to guess a sensible directory name. E.g. cloning a repository 'ssh://user:passw...@example.com/' we guess a directory name 'passw...@example.com' where we would want the hostname only, e.g. 'example.com'. The

[PATCH v5 4/5] clone: do not use port number as dir name

2015-08-10 Thread Patrick Steinhardt
If the URI contains a port number and the URI's path component is empty we fail to guess a sensible directory name. E.g. cloning a repository 'ssh://example.com:/' we guess a directory name '' where we would want the hostname only, e.g. 'example.com'. We need to take care to not drop

[PATCH v5 2/5] clone: use computed length in guess_dir_name

2015-08-10 Thread Patrick Steinhardt
From: Jeff King p...@peff.net Commit 7e837c6 (clone: simplify string handling in guess_dir_name(), 2015-07-09) changed clone to use strip_suffix instead of hand-rolled pointer manipulation. However, strip_suffix will strip from the end of a NUL-terminated string, and we may have already stripped

[PATCH v5 5/5] clone: abort if no dir name could be guessed

2015-08-10 Thread Patrick Steinhardt
Due to various components of the URI being stripped off it may happen that we fail to guess a directory name. We currently error out with a message that it is impossible to create the working tree '' in such cases. Instead, error out early with a sensible error message hinting that a directory

[PATCH v5 1/5] clone: add tests for output directory

2015-08-10 Thread Patrick Steinhardt
From: Jeff King p...@peff.net When we run git clone $url, clone guesses from the $url what to name the local output directory. We don't have any test coverage of this, so let's add some basic tests. This reveals a few problems: - cloning foo.git/ does not properly remove the .git; this is

Re: Feature: git stash pop --always-drop

2015-08-10 Thread Ed Avis
Junio C Hamano gitster at pobox.com writes: Yes, my use case is that I get confused about whether the stash has been dropped or not and whether I might have stashed something else in the meantime. So for me plain 'git stash drop' feels a bit dangerous. Then git stash apply followed by git

Re: [PATCH 2/2] pager_in_use: make sure output is still going to pager

2015-08-10 Thread Johannes Schindelin
Hi Peff, On 2015-08-10 07:23, Jeff King wrote: diff --git a/compat/pipe-id.c b/compat/pipe-id.c new file mode 100644 index 000..4764c5f --- /dev/null +++ b/compat/pipe-id.c @@ -0,0 +1,25 @@ +#include git-compat-util.h +#include compat/pipe-id.h +#include strbuf.h + +const char

Re: File Hash for Windows executable

2015-08-10 Thread Johannes Schindelin
Hi Ryan, On 2015-08-10 15:54, Kiser, Ryan Lee wrote: I've downloaded the Windows installer for Git, Which one. but can't seem to find hashes published anywhere for verification. Since the downloaded file doesn't seem to be signed, The newest ones from https://git-for-windows.github.io/

Re: [PATCH 0/17] removing questionable uses of git_path

2015-08-10 Thread Junio C Hamano
Jeff King p...@peff.net writes: The problem is that git_path uses a static buffer that gets overwritten by subsequent calls. As the rotating static buffer pattern used in get_pathname() was modeled after sha1_to_hex(), we have the same issue there. They are troubles waiting to happen unless

Re: resolving a (possibly remote) branch HEAD to a hash

2015-08-10 Thread Junio C Hamano
per...@pluto.rain.com (Perry Hutchison) writes: ... we do not say append 'refs/remotes/anything/' for various values of anything and see if such a ref exists when resolving an abbreviated refname 'master'. checkout appears to. You are referring to this part of the documentation: If

Re: git blame breaking on repository with CRLF files

2015-08-10 Thread Junio C Hamano
Torsten Bögershausen tbo...@web.de writes: Actually I could reproduce the following: CRLF in repo, CRLF in working tree, core.autocrlf= true. What should happen in such a case? Wouldn't autocrlf=true want to strip CRLF down to LF? Shouldn't it? And if so, blame is correct to say that you

Re: [PATCH 2/2] pager_in_use: make sure output is still going to pager

2015-08-10 Thread Jeff King
On Mon, Aug 10, 2015 at 06:38:10PM +0200, Johannes Schindelin wrote: +const char *pipe_id_get(int fd) +{ + static struct strbuf id = STRBUF_INIT; + struct stat st; + + if (fstat(fd, st) 0 || !S_ISFIFO(st.st_mode)) + return NULL; Just a quick note: it seems that

Re: [PATCH 0/17] removing questionable uses of git_path

2015-08-10 Thread Jeff King
On Mon, Aug 10, 2015 at 10:31:32AM -0700, Junio C Hamano wrote: Jeff King p...@peff.net writes: The problem is that git_path uses a static buffer that gets overwritten by subsequent calls. As the rotating static buffer pattern used in get_pathname() was modeled after sha1_to_hex(), we

Re: Error when cloning with weird local directory

2015-08-10 Thread Junio C Hamano
Torsten Bögershausen tbo...@web.de writes: So I think that git clone can be slighty more consistant here. Sure. I _think_ taking notice of word:// (with doubled slashes) and treating it specially will not introduce any new issue; while it is still OK for users to have a local directory

Re: [PATCH] submodule: implement `module_name` as a builtin helper

2015-08-10 Thread Stefan Beller
On Fri, Aug 7, 2015 at 11:20 PM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: ... if you really want to go the thread route, the first thing to try would be to see if a few places we already use threads for parallelism (namely, grep, pack-objects,

[PATCH v6] notes: handle multiple worktrees

2015-08-10 Thread David Turner
Before creating NOTES_MERGE_REF, check NOTES_MERGE_REF using find_shared_symref and die if we find one. This prevents simultaneous merges to the same notes branch from different worktrees. Signed-off-by: David Turner dtur...@twopensource.com --- This reroll addresses Eric Sunshine's comments on

[PATCH v6 1/2] worktrees: add find_shared_symref

2015-08-10 Thread David Turner
Add a new function, find_shared_symref, which contains the heart of die_if_checked_out, but works for any symref, not just HEAD. Refactor die_if_checked_out to use the same infrastructure as find_shared_symref. Soon, we will use find_shared_symref to protect notes merges in worktrees.

[PATCH v6 2/2] notes: handle multiple worktrees

2015-08-10 Thread David Turner
Before creating NOTES_MERGE_REF, check NOTES_MERGE_REF using find_shared_symref and die if we find one. This prevents simultaneous merges to the same notes branch from different worktrees. Signed-off-by: David Turner dtur...@twopensource.com --- builtin/notes.c | 6

Re: [PATCHv3 1/2] config: add '--names-only' option to list only variable names

2015-08-10 Thread Junio C Hamano
SZEDER Gábor sze...@ira.uka.de writes: 'git config' can only show values or name-value pairs, so if a shell script needs the names of set config variables it has to run 'git config --list' or '--get-regexp' and parse the output to separate config variable names from their values. However,

Re: [PATCH] sha1_file.c: rename move_temp_to_file() to finalize_temp_file()

2015-08-10 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Fri, Aug 07, 2015 at 05:24:29PM -0700, Junio C Hamano wrote: Since 5a688fe4 (core.sharedrepository = 0mode should set, not loosen, 2009-03-25), we kept reminding ourselves: NEEDSWORK: this should be renamed to finalize_temp_file() as moving is

Re: [PATCH v6] notes: handle multiple worktrees

2015-08-10 Thread David Turner
Sorry, that should have included the first patch as well. Will re-send as .v7 On Mon, 2015-08-10 at 13:43 -0400, David Turner wrote: Before creating NOTES_MERGE_REF, check NOTES_MERGE_REF using find_shared_symref and die if we find one. This prevents simultaneous merges to the same notes

RE: File Hash for Windows executable

2015-08-10 Thread Kiser, Ryan Lee
Ah, perfect. Thank you. I was looking at 1.9.5 from http://www.git-scm.com/download Thanks for pointing me at the right place. -Ryan -Original Message- From: Johannes Schindelin [mailto:johannes.schinde...@gmx.de] Sent: Monday, August 10, 2015 12:10 PM To: Kiser, Ryan Lee

Re: [PATCH v5 0/5] Improve guessing of repository names

2015-08-10 Thread Junio C Hamano
Patrick Steinhardt p...@pks.im writes: This is version 5 of my patch series which aims to improve guessed directory names in several cases. This version now includes the patches from Jeff which were previously a separate patch series. Besides fixing behavior when cloning a repository with

Re: Feature: git stash pop --always-drop

2015-08-10 Thread Junio C Hamano
Ed Avis e...@waniasset.com writes: Yes, my use case is that I get confused about whether the stash has been dropped or not and whether I might have stashed something else in the meantime. So for me plain 'git stash drop' feels a bit dangerous. Then git stash apply followed by git stash drop

Re: [PATCH v5 0/4] submodule config lookup API

2015-08-10 Thread Stefan Beller
On Mon, Jun 15, 2015 at 2:48 PM, Junio C Hamano gits...@pobox.com wrote: Thanks. Will replace and wait for comments from others. I have reviewed the patches carefully and they look good to me. As Git is a large project and I was active in other parts until now, I noticed that there are subtle

Re: git blame breaking on repository with CRLF files

2015-08-10 Thread Torsten Bögershausen
On 2015-08-10 20.48, Junio C Hamano wrote: Torsten Bögershausen tbo...@web.de writes: Actually I could reproduce the following: CRLF in repo, CRLF in working tree, core.autocrlf= true. What should happen in such a case? Wouldn't autocrlf=true want to strip CRLF down to LF? Shouldn't it?

[PATCH v3] worktree: add 'list' command

2015-08-10 Thread Michael Rappazzo
Differences from [v2](http://www.mail-archive.com/git@vger.kernel.org/msg75467.html) - removed unintended whitespace changes - cleanup based on comments from v2 Michael Rappazzo (1): worktree: add 'list' command Documentation/git-worktree.txt | 6 +++- builtin/worktree.c |

Re: [PATCH] config.mak.uname: Cygwin: Use renames for creation

2015-08-10 Thread Junio C Hamano
Adam Dinwoodie a...@dinwoodie.org writes: If the desired goal is that Cygwin's link(2) acts like POSIX link(2) on network drives, I'm not convinced that's possible, at least not by emulating `core.createObject = rename` in the Cygwin library layer. The way core.createObject=rename makes

Re

2015-08-10 Thread git-owner
Your Donation to you is ready, contact melc...@gmail.com for more details -- 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] worktree: add 'list' command

2015-08-10 Thread Michael Rappazzo
'git worktree list' will list the main worktree followed by any linked worktrees which were created using 'git worktree add'. Signed-off-by: Michael Rappazzo rappa...@gmail.com --- Documentation/git-worktree.txt | 6 +++- builtin/worktree.c | 67

Re: [PATCH v3] worktree: add 'list' command

2015-08-10 Thread Junio C Hamano
Michael Rappazzo rappa...@gmail.com writes: +static int list(int ac, const char **av, const char *prefix) +{ + int main_only = 0; + struct option options[] = { + OPT_BOOL(0, main-only, main_only, N_(only list the main worktree)), + OPT_END() + }; Hmm,

Re: [PATCH v6 1/2] worktrees: add find_shared_symref

2015-08-10 Thread Eric Sunshine
On Mon, Aug 10, 2015 at 1:52 PM, David Turner dtur...@twopensource.com wrote: worktrees: add find_shared_symref s/worktrees/branch/ perhaps? Add a new function, find_shared_symref, which contains the heart of die_if_checked_out, but works for any symref, not just HEAD. Refactor

Re: [PATCH 05/17] remove hold_lock_file_for_append

2015-08-10 Thread Junio C Hamano
Jeff King p...@peff.net writes: No users of hold_lock_file_for_append remain, so remove it. This does not seem to have anything to do with rotating static buffers used in get_pathname(); the only effect it has is to conflict heavily with Michael's tempfile topic X-. Perhaps this should be part

Re: Error pushing new branch: value too great for base (error token is...

2015-08-10 Thread Eric Sunshine
On Mon, Aug 10, 2015 at 6:29 PM, Jacob Keller jacob.kel...@gmail.com wrote: On Mon, Aug 10, 2015 at 2:54 AM, Gaurav Chhabra varuag.chha...@gmail.com wrote: Apologies for the delay in reply! I tried your suggestion and it works. Thanks! :) I'm curious why integer comparison is throwing error.

Re: [PATCH 10/17] path.c: drop git_path_submodule

2015-08-10 Thread Junio C Hamano
Jeff King p...@peff.net writes: There are no callers of the slightly-dangerous static-buffer git_path_submodule left. Let's drop it. There are a few callers added on 'pu', though. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to

Re: git blame breaking on repository with CRLF files

2015-08-10 Thread brian m. carlson
On Mon, Aug 10, 2015 at 08:36:35AM +, Benkstein, Frank wrote: You are correct that it is also wrong in git v1.7.0. However, it is correct in v2.4.0. Another bisect gave me this commit which was included in v2.0.1: commit 4d4813a52f3722854a54bab046f4abfec13ef6ae Author: brian m.

Re: [PATCH v2] send-email: provide whitelist of SMTP AUTH mechanisms

2015-08-10 Thread Eric Sunshine
On Mon, Aug 10, 2015 at 6:06 AM, Jan Viktorin vikto...@rehivetech.com wrote: On Sun, 9 Aug 2015 14:13:33 -0400 Eric Sunshine sunsh...@sunshineco.com wrote: One possibility which comes to mind is to create a fake Authen::SASL::Perl which merely dumps its input mechanisms to a file, and arrange

Re: Error pushing new branch: value too great for base (error token is...

2015-08-10 Thread Jacob Keller
On Mon, Aug 10, 2015 at 2:54 AM, Gaurav Chhabra varuag.chha...@gmail.com wrote: Apologies for the delay in reply! I tried your suggestion and it works. Thanks! :) I'm curious why integer comparison is throwing error. Shouldn't i be comparing numbers with numeric operator? Yes, but shell

Re: [PATCH v6 1/2] worktrees: add find_shared_symref

2015-08-10 Thread David Turner
On Mon, 2015-08-10 at 18:30 -0400, Eric Sunshine wrote: On Mon, Aug 10, 2015 at 1:52 PM, David Turner dtur...@twopensource.com wrote: worktrees: add find_shared_symref s/worktrees/branch/ perhaps? Do you mean this is in branch.c, so should be labeled with branch? Because this change is

Re: [PATCH v6 1/2] worktrees: add find_shared_symref

2015-08-10 Thread Eric Sunshine
On Mon, Aug 10, 2015 at 6:42 PM, David Turner dtur...@twopensource.com wrote: On Mon, 2015-08-10 at 18:30 -0400, Eric Sunshine wrote: On Mon, Aug 10, 2015 at 1:52 PM, David Turner dtur...@twopensource.com wrote: worktrees: add find_shared_symref s/worktrees/branch/ perhaps? Do you mean

Re: [PATCH 10/17] path.c: drop git_path_submodule

2015-08-10 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Jeff King p...@peff.net writes: There are no callers of the slightly-dangerous static-buffer git_path_submodule left. Let's drop it. There are a few callers added on 'pu', though. Actually there is only one. Here is a proposed evil merge. diff

Re: [PATCH 10/17] path.c: drop git_path_submodule

2015-08-10 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Junio C Hamano gits...@pobox.com writes: Jeff King p...@peff.net writes: There are no callers of the slightly-dangerous static-buffer git_path_submodule left. Let's drop it. There are a few callers added on 'pu', though. Actually there is only

Re: [PATCH 04/17] add_to_alternates_file: don't add duplicate entries

2015-08-10 Thread Michael Haggerty
On 08/10/2015 11:34 AM, Jeff King wrote: The add_to_alternates_file function blindly uses hold_lock_file_for_append to copy the existing contents, and then adds the new line to it. This has two minor problems: 1. We might add duplicate entries, which are ugly and inefficient. 2.

Re: [PATCH 04/10] branch: roll show_detached HEAD into regular ref_list

2015-08-10 Thread Eric Sunshine
On Tue, Aug 4, 2015 at 9:01 AM, Karthik Nayak karthik@gmail.com wrote: Remove show_detached() and make detached HEAD to be rolled into regular ref_list by adding REF_DETACHED_HEAD as a kind of branch and supporting the same in append_ref(). This eliminates the need for an extra function

Re: [PATCH v3] worktree: add 'list' command

2015-08-10 Thread David Turner
On Mon, 2015-08-10 at 16:53 -0400, Michael Rappazzo wrote: + while ((d = readdir(dir)) != NULL) { I think it would be useful to break this loop out into a for_each_worktree function. While looking into per-worktree ref stuff, I have just noticed that git prune will delete

Re: [PATCH 02/10] branch: refactor width computation

2015-08-10 Thread Eric Sunshine
On Tue, Aug 4, 2015 at 9:01 AM, Karthik Nayak karthik@gmail.com wrote: Remove unnecessary variables from ref_list and ref_item which were used for width computation. This is to make ref_item similar to ref-filter's ref_array_item. This will ensure a smooth port of branch.c to use

Re: [PATCH 03/10] branch: bump get_head_description() to the top

2015-08-10 Thread Eric Sunshine
On Tue, Aug 4, 2015 at 9:01 AM, Karthik Nayak karthik@gmail.com wrote: This is a preperatory patch for 'roll show_detached HEAD into regular ref_list'. This patch moves get_head_descrition() to the top so that s/descrition/description/ it can be used in print_ref_item(). Signed-off-by:

Re: Bug report Windows 10

2015-08-10 Thread Konstantin Khomoutov
On Mon, 10 Aug 2015 14:26:44 +0200 MS-Informatique i...@ms-informatique.be wrote: My Windows notebook got updated to Windows 10 and now my Git Bash doesn't start and when I open an existing repository from Git Gui, I am getting next error: 0 [main] us 0 init_cheap: VirtualAlloc pointer is

Re: Feature: git stash pop --always-drop

2015-08-10 Thread Jeff King
On Mon, Aug 10, 2015 at 10:42:30AM +, Ed Avis wrote: I would find it useful to ask 'git stash pop' to always drop the stash after applying it to the working tree, even if there were conflicts. (Only if there was some hard error, such as an I/O error updating some of the files, should the

Re: Feature: git stash pop --always-drop

2015-08-10 Thread Ed Avis
An alternative would be for git stash to always print the name of the stash it is applying. Then you can drop it afterwards by name and be sure you got the right one. Printing the name of the stash sounds like a reasonable bit of chatter to add anyway, do you agree? -- Ed Avis

Re: Bug report Windows 10

2015-08-10 Thread Johannes Schindelin
Hi, On 2015-08-10 14:26, MS-Informatique wrote: My Windows notebook got updated to Windows 10 and now my Git Bash doesn't start and when I open an existing repository from Git Gui, I am getting next error: 0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487

[PATCH 02/17] cache.h: complete set of git_path_submodule helpers

2015-08-10 Thread Jeff King
The git_path function has git_pathdup and strbuf_git_path variants, but git_submodule_path only comes in the dangerous, static-buffer variant. That makes refactoring callers to use the safer functions hard (since they don't exist). Since we're already using a strbuf behind the scenes, it's easy

[PATCH 03/17] t5700: modernize style

2015-08-10 Thread Jeff King
The early part of this test is rather old, and does not follow our usual style guidelines. In particular: - the tests liberally chdir, and expect out-of-test cd commands to return them to a sane state - test commands aren't indented at all - there are a lot of minor formatting nits,

[PATCH 01/17] cache.h: clarify documentation for git_path, et al

2015-08-10 Thread Jeff King
The comment above these functions actually describes sha1_file_name, and comes from the very first revision of git. Commit 723c31f (Add git_path() and head_ref() helper functions., 2005-07-05) added git_path, pushing the comment away from the function it describes; later commits added more

[PATCH 07/17] prefer mkpathdup to mkpath in assignments

2015-08-10 Thread Jeff King
As with the previous commit to git_path, assigning the result of mkpath is suspicious, since it is not clear whether we will still depend on the value after it may have been overwritten by subsequent calls. This patch converts low-hanging fruit to use mkpathdup instead of mkpath (with the downside

[PATCH 06/17] prefer git_pathdup to git_path in some possibly-dangerous cases

2015-08-10 Thread Jeff King
Because git_path uses a static buffer that is shared with calls to git_path, mkpath, etc, it can be dangerous to assign the result to a variable or pass it to a non-trivial function. The value may change unexpectedly due to other calls. None of the cases changed here has a known bug, but they're

[PATCH 08/17] remote.c: drop extraneous local variable from migrate_file

2015-08-10 Thread Jeff King
It's an anti-pattern to assign the result of git_path to a variable, since other calls may reuse our buffer. In this case, we feed the result to unlink_or_warn immediately afterwards, so it's OK. However, it's nice to avoid assignment entirely, which makes it more obvious that there's no bug. We

[PATCH 09/17] refs.c: remove extra git_path calls from read_loose_refs

2015-08-10 Thread Jeff King
In iterating over the loose refs in refs/foo/, we keep a running strbuf with refs/foo/one, refs/foo/two, etc. But we also need to access these files in the filesystem, as .git/refs/foo/one, etc. For this latter purpose, we make a series of independent calls to git_path(). These are safe (we only

[PATCH 05/17] remove hold_lock_file_for_append

2015-08-10 Thread Jeff King
From: Jim Hill gjth...@gmail.com No users of hold_lock_file_for_append remain, so remove it. hold_lock_file_for_append copies its target file internally. This makes it too heavyweight for true append-only logging and too limited for anything else (which probably wants to process the contents).

[PATCHv3 2/2] completion: list variable names reliably with 'git config --names-only'

2015-08-10 Thread SZEDER Gábor
Recenty I created a multi-line branch description with '.' and '=' characters on one of the lines, and noticed that fragments of that line show up when completing set variable names for 'git config', e.g.: $ git config --get branch.b.description Branch description to fool the completion

[PATCH v2 00/16] Introduce a tempfile module

2015-08-10 Thread Michael Haggerty
This is a re-roll of the tempfile patch series [1]. I'm sorry for the long delay getting v2 out. Thanks to Junio and Johannes Sixt for their feedback about v1. I think I have addressed all of their points. This version is very similar to v1 in spirit, though quite a few details have changed. The

[PATCHv3 1/2] config: add '--names-only' option to list only variable names

2015-08-10 Thread SZEDER Gábor
'git config' can only show values or name-value pairs, so if a shell script needs the names of set config variables it has to run 'git config --list' or '--get-regexp' and parse the output to separate config variable names from their values. However, such a parsing can't cope with multi-line

[PATCHv3 0/2] 'git config --names-only' to help the completion script

2015-08-10 Thread SZEDER Gábor
This is a reroll of 'sg/config-name-only'. * Instead of the two new listing options of the previous round add one new option '--names-only' to modify the output of '--list' and '--get-regexp' options, as suggested in previous discussions. * Reorganized the commit messages: don't go

[PATCH v2 02/16] create_bundle(): duplicate file descriptor to avoid closing it twice

2015-08-10 Thread Michael Haggerty
write_pack_data() passes bundle_fd to start_command() to be used as the stdout of pack-objects. But start_command() closes its stdout if it is 1. This is a problem if bundle_fd is the fd of a lock_file, because commit_lock_file() will also try to close the fd. So the old code suppressed

[PATCH v2 15/16] credential-cache--daemon: delete socket from main()

2015-08-10 Thread Michael Haggerty
main() is responsible for cleaning up the socket in the case of errors, so it is reasonable to also make it responsible for cleaning it up when there are no errors. This change also makes the next step easier. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- credential-cache--daemon.c |

RE: git blame breaking on repository with CRLF files

2015-08-10 Thread Benkstein, Frank
Hello Torsten, Torsten Bögershausen, Sonntag, 9. August 2015 22:20: On 2015-08-08 07.58, Torsten Bögershausen wrote: On 2015-08-07 18.32, Benkstein, Frank wrote: I am working working on Linux and am examining code in a git repository I do not know much about. I am only looking at files, not

[PATCH 0/17] removing questionable uses of git_path

2015-08-10 Thread Jeff King
Recently Michael and I were working on a patch series (not yet published), which did something like: const char *path = git_path(foo); ... do stuff with path ... for_each_ref(some_callback, NULL); ... do some other stuff ... unlink(path); Clever readers may have spotted the bug

[PATCH 04/17] add_to_alternates_file: don't add duplicate entries

2015-08-10 Thread Jeff King
The add_to_alternates_file function blindly uses hold_lock_file_for_append to copy the existing contents, and then adds the new line to it. This has two minor problems: 1. We might add duplicate entries, which are ugly and inefficient. 2. We do not check that the file ends with a

[PATCH 16/17] get_repo_path: refactor path-allocation

2015-08-10 Thread Jeff King
The get_repo_path function calls mkpath() and then does some non-trivial operations on it, like calling is_git_directory() and read_gitfile(). These are actually OK (they do not use more pathname static buffers themselves), but it takes a fair bit of work to verify. Let's use our own strbuf to

[PATCH 13/17] refs.c: avoid git_path assignment in lock_ref_sha1_basic

2015-08-10 Thread Jeff King
Assigning the result of git_path is a bad pattern, because it's not immediately obvious how long you expect the content to stay valid (and it may be overwritten by subsequent calls). Let's use a function-local strbuf here instead, which we know is safe (we just have to remember to free it in all

[PATCH 12/17] refs.c: avoid repeated git_path calls in rename_tmp_log

2015-08-10 Thread Jeff King
Because it's not safe to store the static-buffer results of git_path for a long time, we end up formatting the same filename over and over. We can fix this by using a function-local strbuf to store the formatted pathname and avoid repeating ourselves. Signed-off-by: Jeff King p...@peff.net ---

[PATCH 10/17] path.c: drop git_path_submodule

2015-08-10 Thread Jeff King
There are no callers of the slightly-dangerous static-buffer git_path_submodule left. Let's drop it. Signed-off-by: Jeff King p...@peff.net --- cache.h | 5 ++--- path.c | 10 -- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/cache.h b/cache.h index 6f74f33..7a4fa90

[PATCH 11/17] refs.c: simplify strbufs in reflog setup and writing

2015-08-10 Thread Jeff King
Commit 1a83c24 (git_snpath(): retire and replace with strbuf_git_path(), 2014-11-30) taught log_ref_setup and log_ref_write_1 to take a strbuf parameter, rather than a bare string. It then makes an alias to the strbuf's buf field under the original name. This made the original diff much shorter,

[PATCH 15/17] find_hook: keep our own static buffer

2015-08-10 Thread Jeff King
The find_hook function returns the results of git_path, which is a static buffer shared by other path-related calls. Returning such a buffer is slightly dangerous, because it can be overwritten by seemingly unrelated functions. Let's at least keep our _own_ static buffer, so you can only get in

[PATCH 14/17] refs.c: remove_empty_directories can take a strbuf

2015-08-10 Thread Jeff King
The first thing we do in this function is copy the input into a strbuf. Of the 4 callers, 3 of them already have a strbuf we could use. Let's just take the strbuf, and convert the remaining caller to use a strbuf, rather than a raw git_path. This is safer, anyway, as remove_dir_recursively is a

[PATCH 17/17] memoize common git-path constant files

2015-08-10 Thread Jeff King
One of the most common uses of git_path() is to pass a constant, like git_path(MERGE_MSG). This has two drawbacks: 1. The return value is a static buffer, and the lifetime is dependent on other calls to git_path, etc. 2. There's no compile-time checking of the pathname. This is OK

[PATCH v2 10/16] write_shared_index(): use tempfile module

2015-08-10 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- read-cache.c | 38 ++ 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/read-cache.c b/read-cache.c index 96cb9a3..89be226 100644 --- a/read-cache.c +++ b/read-cache.c @@ -5,6 +5,7 @@ */

[PATCH v2 07/16] prepare_tempfile_object(): new function, extracted from create_tempfile()

2015-08-10 Thread Michael Haggerty
This makes the next step easier. The old code used to use path to set the initial length of tempfile-filename. This was not helpful because path was usually relative whereas the value stored to filename will be absolute. So just initialize the length to 0. Signed-off-by: Michael Haggerty

[PATCH v2 03/16] lockfile: add accessors get_lock_file_fd() and get_lock_file_fp()

2015-08-10 Thread Michael Haggerty
We are about to move those members, so change client code to read them through accessor functions. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- credential-store.c | 2 +- lockfile.c | 14 ++ lockfile.h | 3 +++ read-cache.c | 2 +- refs.c

[PATCH v2 13/16] lock_repo_for_gc(): compute the path to gc.pid only once

2015-08-10 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/gc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 36fe333..c41354b 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -199,6 +199,7 @@ static const char

[PATCH v2 04/16] lockfile: add accessor get_lock_file_path()

2015-08-10 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/commit.c | 15 --- config.c | 14 +++--- lockfile.c | 7 +++ lockfile.h | 6 ++ refs.c | 6 +++--- shallow.c| 6 +++--- 6 files changed, 34 insertions(+), 20

[PATCH v2 11/16] setup_temporary_shallow(): use tempfile module

2015-08-10 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- shallow.c | 35 +++ 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/shallow.c b/shallow.c index 7973e74..2ba29a5 100644 --- a/shallow.c +++ b/shallow.c @@ -1,4 +1,5 @@ #include cache.h

[PATCH v2 14/16] gc: use tempfile module to handle gc.pid file

2015-08-10 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/gc.c | 25 + 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index c41354b..bfe589f 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -11,6 +11,7 @@ */ #include

[PATCH v2 05/16] commit_lock_file(): use get_locked_file_path()

2015-08-10 Thread Michael Haggerty
First beef up the sanity checking in get_locked_file_path() to match that in commit_lock_file(). Then rewrite commit_lock_file() to use get_locked_file_path() for its pathname computation. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- lockfile.c | 28 1

[PATCH v2 08/16] tempfile: add several functions for creating temporary files

2015-08-10 Thread Michael Haggerty
Add several functions for creating temporary files with automatically-generated names, analogous to mkstemps(), but also arranging for the files to be deleted on program exit. The functions are named according to a pattern depending how they operate. They will be used to replace many places in

[PATCH v2 01/16] Move lockfile documentation to lockfile.h and lockfile.c

2015-08-10 Thread Michael Haggerty
Rearrange/rewrite it somewhat to fit its new environment. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- Documentation/technical/api-lockfile.txt | 220 --- lockfile.c | 53 ++ lockfile.h | 290

[PATCH v2 06/16] tempfile: a new module for handling temporary files

2015-08-10 Thread Michael Haggerty
A lot of work went into defining the state diagram for lockfiles and ensuring correct, race-resistant cleanup in all circumstances. Most of that infrastructure can be applied directly to *any* temporary file. So extract a new tempfile module from the lockfile module. Reimplement lockfile on top

[PATCH v2 12/16] diff: use tempfile module

2015-08-10 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- diff.c | 29 +++-- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/diff.c b/diff.c index 7500c55..dc95247 100644 --- a/diff.c +++ b/diff.c @@ -2,6 +2,7 @@ * Copyright (C) 2005 Junio C Hamano */

[PATCH v2 16/16] credential-cache--daemon: use tempfile module

2015-08-10 Thread Michael Haggerty
Use the tempfile module to ensure that the socket file gets deleted on program exit. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- credential-cache--daemon.c | 26 ++ 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/credential-cache--daemon.c

Feature: git stash pop --always-drop

2015-08-10 Thread Ed Avis
I would find it useful to ask 'git stash pop' to always drop the stash after applying it to the working tree, even if there were conflicts. (Only if there was some hard error, such as an I/O error updating some of the files, should the stash be left on the stack.) Would a patch for such an

Re: [PATCH v2] send-email: provide whitelist of SMTP AUTH mechanisms

2015-08-10 Thread Jan Viktorin
On Sun, 9 Aug 2015 14:13:33 -0400 Eric Sunshine sunsh...@sunshineco.com wrote: On Wed, Aug 5, 2015 at 3:17 AM, Jan Viktorin vikto...@rehivetech.com wrote: Do I understand well that you are complaining about too narrow commmit message? Yes, I'm a complainer. ;-) It's minor, though, not a

Re: Error pushing new branch: value too great for base (error token is...

2015-08-10 Thread Gaurav Chhabra
Apologies for the delay in reply! I tried your suggestion and it works. Thanks! :) I'm curious why integer comparison is throwing error. Shouldn't i be comparing numbers with numeric operator? On Mon, Aug 10, 2015 at 3:23 PM, Gaurav Chhabra varuag.chha...@gmail.com wrote: Apologies for the

Re: [PATCH 11/17] refs.c: simplify strbufs in reflog setup and writing

2015-08-10 Thread Michael Haggerty
On 08/10/2015 11:36 AM, Jeff King wrote: Commit 1a83c24 (git_snpath(): retire and replace with strbuf_git_path(), 2014-11-30) taught log_ref_setup and log_ref_write_1 to take a strbuf parameter, rather than a bare string. It then makes an alias to the strbuf's buf field under the original

Re: [PATCHv3 1/2] config: add '--names-only' option to list only variable names

2015-08-10 Thread Jeff King
On Mon, Aug 10, 2015 at 11:46:06AM +0200, SZEDER Gábor wrote: 'git config' can only show values or name-value pairs, so if a shell script needs the names of set config variables it has to run 'git config --list' or '--get-regexp' and parse the output to separate config variable names from

Re: [PATCHv3 2/2] completion: list variable names reliably with 'git config --names-only'

2015-08-10 Thread Jeff King
On Mon, Aug 10, 2015 at 11:46:07AM +0200, SZEDER Gábor wrote: Use the new '--names-only' option added in the previous commit to list config variable names reliably in both cases, without error-prone post processing. Signed-off-by: SZEDER Gábor sze...@ira.uka.de This looks like a pretty

Re: Feature: git stash pop --always-drop

2015-08-10 Thread Jeff King
On Mon, Aug 10, 2015 at 12:50:51PM +, Ed Avis wrote: An alternative would be for git stash to always print the name of the stash it is applying. Then you can drop it afterwards by name and be sure you got the right one. Printing the name of the stash sounds like a reasonable bit of

Re: Feature: git stash pop --always-drop

2015-08-10 Thread Ed Avis
Jeff King peff at peff.net writes: An alternative would be for git stash to always print the name of the stash it is applying. Applying refs/stash@{0} (31cb86c3d700d241e315d989f460e3e83f84fa19) Yes, that's the one. Or maybe it would be useful to actually show the stash subject, That could

  1   2   >