Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread Junio C Hamano
David Aguilar writes: > Reading the code again, the point of add_left_or_right() > is to populate the worktree (done later in the loop) with > the stuff we read from Git. Thus, if we changed just this > section to call get_symlink() then we should not even try > to checkout any symlink entries i

Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread Junio C Hamano
Junio C Hamano writes: >> +struct strbuf path = STRBUF_INIT; >> +struct strbuf link = STRBUF_INIT; >> + >> +int ok = 0; >> + >> +if (strbuf_readlink(&link, ce->name, ce_namelen(ce)) == 0) { >> +strbuf_add(&path, state->base_dir, state->base_dir_len); >> +st

Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread David Aguilar
On Mon, Mar 13, 2017 at 02:33:09PM -0700, Junio C Hamano wrote: > Johannes Schindelin writes: > > >> > +if (strbuf_readlink(&link, ce->name, ce_namelen(ce)) == 0) { > >> > +strbuf_add(&path, state->base_dir, state->base_dir_len); > >> > +strbuf_add(&path, c

Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread Johannes Schindelin
Hi David, Thank you very much for picking this up! On Mon, 13 Mar 2017, David Aguilar wrote: > Detect the null object ID for symlinks in dir-diff so that difftool can > prepare temporary files that matches how git handles symlinks. Maybe a description is needed how the OID can be null in that c

Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread Junio C Hamano
Johannes Schindelin writes: >> > + if (strbuf_readlink(&link, ce->name, ce_namelen(ce)) == 0) { >> > + strbuf_add(&path, state->base_dir, state->base_dir_len); >> > + strbuf_add(&path, ce->name, ce_namelen(ce)); >> > + >> > + write_file_buf(path.buf, link.buf, link.len

Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread Johannes Schindelin
Hi Junio, On Mon, 13 Mar 2017, Junio C Hamano wrote: > David Aguilar writes: > > > +static int create_symlink_file(struct cache_entry* ce, struct checkout* > > state) > > Asterisk sticks to variable, not type. If only we had tools to format the code so that authors as well as reviewers could

Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread Johannes Schindelin
Hi Junio, On Mon, 13 Mar 2017, Junio C Hamano wrote: > David Aguilar writes: > > > Detect the null object ID for symlinks in dir-diff so that difftool > > can prepare temporary files that matches how git handles symlinks. > > > > Previously, a null object ID would crash difftool. We now detect

Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread Junio C Hamano
David Aguilar writes: > - if (S_ISLNK(lmode)) { > + if (S_ISLNK(lmode) && !is_null_oid(&loid)) { > char *content = read_sha1_file(loid.hash, &type, &size); > add_left_or_right(&symlinks2, src_path, content, 0); >

Re: [PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread Junio C Hamano
David Aguilar writes: > Detect the null object ID for symlinks in dir-diff so that difftool can > prepare temporary files that matches how git handles symlinks. > > Previously, a null object ID would crash difftool. We now detect null > object IDs and write the symlink's content into the tempora

[PATCH] difftool: handle changing symlinks in dir-diff mode

2017-03-13 Thread David Aguilar
Detect the null object ID for symlinks in dir-diff so that difftool can prepare temporary files that matches how git handles symlinks. Previously, a null object ID would crash difftool. We now detect null object IDs and write the symlink's content into the temporary symlink stand-in file. Origin