Re: Teach git-update-index about gitlinks
- From
Junio C Hamano <junkio@cox.net>
- Date
- Apr 12, 2007, 22:45 UTC
- Message-ID
- <7vtzvli53u.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0704121218130.4061@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> Junio - if you prefer Alex' patch instead, I won't be upset. This is > definitely a bigger re-org, and while I think it makes sense as a patch > even *aside* from the gitlink support, it's probably largely a matter of > taste.
I find the result of applying this patch much easier to read than the original.
Show 13 quoted lines
> +/*
> + * Process a regular file
> + */
> +static int process_file(const char *path, int len, struct stat *st)
> +{
> + int pos = cache_name_pos(path, len);
> + struct cache_entry *ce = pos < 0 ? NULL : active_cache[pos];
> +
> + if (ce && S_ISDIRLNK(ntohl(ce->ce_mode)))
> + return error("%s is already a gitlink, not replacing", path);
> +
> + return add_one_path(ce, path, len, st);
> +}I may be missing the obvious but if I have a subproject at "path/S" and I say "update-index path/S/Makefile", what should happen? There is ISDIRLNK entry at path/S and add_one_path() would allow removal of "path/S" to make room for path/S/Makefile, when --replace is given.