Skip to content

Commit e22fb77

Browse files
committed
Merge pull request git-for-windows#1897 from piscisaureus/symlink-attr
Specify symlink type in .gitattributes
2 parents 80c6dc9 + d7d4b3e commit e22fb77

26 files changed

+844
-248
lines changed

Documentation/Makefile

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ docdep_prereqs = \
287287
cmd-list.made $(cmds_txt)
288288

289289
doc.dep : $(docdep_prereqs) $(wildcard *.txt) $(wildcard config/*.txt) build-docdep.perl
290-
$(QUIET_GEN)$(RM) $@+ $@ && \
291-
$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
292-
mv $@+ $@
290+
$(QUIET_GEN)$(RM) $@.new $@ && \
291+
$(PERL_PATH) ./build-docdep.perl >$@.new $(QUIET_STDERR) && \
292+
mv $@.new $@
293293

294294
-include doc.dep
295295

@@ -325,8 +325,8 @@ mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
325325
date >$@
326326

327327
clean:
328-
$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
329-
$(RM) *.texi *.texi+ *.texi++ git.info gitman.info
328+
$(RM) *.xml *.xml.new *.html *.html.new *.1 *.5 *.7
329+
$(RM) *.texi *.texi.new *.texi.new.new git.info gitman.info
330330
$(RM) *.pdf
331331
$(RM) howto-index.txt howto/*.html doc.dep
332332
$(RM) technical/*.html technical/api-index.txt
@@ -335,14 +335,14 @@ clean:
335335
$(RM) manpage-base-url.xsl
336336

337337
$(MAN_HTML): %.html : %.txt asciidoc.conf
338-
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
339-
$(TXT_TO_HTML) -d manpage -o $@+ $< && \
340-
mv $@+ $@
338+
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
339+
$(TXT_TO_HTML) -d manpage -o $@.new $< && \
340+
mv $@.new $@
341341

342342
$(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
343-
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
344-
$(TXT_TO_HTML) -o $@+ $< && \
345-
mv $@+ $@
343+
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
344+
$(TXT_TO_HTML) -o $@.new $< && \
345+
mv $@.new $@
346346

347347
manpage-base-url.xsl: manpage-base-url.xsl.in
348348
$(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
@@ -352,14 +352,14 @@ manpage-base-url.xsl: manpage-base-url.xsl.in
352352
$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
353353

354354
%.xml : %.txt asciidoc.conf
355-
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
356-
$(TXT_TO_XML) -d manpage -o $@+ $< && \
357-
mv $@+ $@
355+
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
356+
$(TXT_TO_XML) -d manpage -o $@.new $< && \
357+
mv $@.new $@
358358

359359
user-manual.xml: user-manual.txt user-manual.conf
360-
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
361-
$(TXT_TO_XML) -d book -o $@+ $< && \
362-
mv $@+ $@
360+
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
361+
$(TXT_TO_XML) -d book -o $@.new $< && \
362+
mv $@.new $@
363363

364364
technical/api-index.txt: technical/api-index-skel.txt \
365365
technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
@@ -376,46 +376,46 @@ XSLT = docbook.xsl
376376
XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
377377

378378
user-manual.html: user-manual.xml $(XSLT)
379-
$(QUIET_XSLTPROC)$(RM) $@+ $@ && \
380-
xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
381-
mv $@+ $@
379+
$(QUIET_XSLTPROC)$(RM) $@.new $@ && \
380+
xsltproc $(XSLTOPTS) -o $@.new $(XSLT) $< && \
381+
mv $@.new $@
382382

383383
git.info: user-manual.texi
384384
$(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
385385

386386
user-manual.texi: user-manual.xml
387-
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
388-
$(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
389-
$(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
390-
rm $@++ && \
391-
mv $@+ $@
387+
$(QUIET_DB2TEXI)$(RM) $@.new $@ && \
388+
$(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@.new.new && \
389+
$(PERL_PATH) fix-texi.perl <$@.new.new >$@.new && \
390+
rm $@.new.new && \
391+
mv $@.new $@
392392

393393
user-manual.pdf: user-manual.xml
394-
$(QUIET_DBLATEX)$(RM) $@+ $@ && \
395-
$(DBLATEX) -o $@+ $(DBLATEX_COMMON) $< && \
396-
mv $@+ $@
394+
$(QUIET_DBLATEX)$(RM) $@.new $@ && \
395+
$(DBLATEX) -o $@.new $(DBLATEX_COMMON) $< && \
396+
mv $@.new $@
397397

398398
gitman.texi: $(MAN_XML) cat-texi.perl texi.xsl
399-
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
400-
($(foreach xml,$(sort $(MAN_XML)),xsltproc -o $(xml)+ texi.xsl $(xml) && \
401-
$(DOCBOOK2X_TEXI) --encoding=UTF-8 --to-stdout $(xml)+ && \
402-
rm $(xml)+ &&) true) > $@++ && \
403-
$(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
404-
rm $@++ && \
405-
mv $@+ $@
399+
$(QUIET_DB2TEXI)$(RM) $@.new $@ && \
400+
($(foreach xml,$(sort $(MAN_XML)),xsltproc -o $(xml).new texi.xsl $(xml) && \
401+
$(DOCBOOK2X_TEXI) --encoding=UTF-8 --to-stdout $(xml).new && \
402+
rm $(xml).new &&) true) > $@.new.new && \
403+
$(PERL_PATH) cat-texi.perl $@ <$@.new.new >$@.new && \
404+
rm $@.new.new && \
405+
mv $@.new $@
406406

407407
gitman.info: gitman.texi
408408
$(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
409409

410410
$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
411-
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
412-
$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
413-
mv $@+ $@
411+
$(QUIET_DB2TEXI)$(RM) $@.new $@ && \
412+
$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@.new && \
413+
mv $@.new $@
414414

415415
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
416-
$(QUIET_GEN)$(RM) $@+ $@ && \
417-
'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@+ && \
418-
mv $@+ $@
416+
$(QUIET_GEN)$(RM) $@.new $@ && \
417+
'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@.new && \
418+
mv $@.new $@
419419

420420
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
421421
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
@@ -424,10 +424,10 @@ WEBDOC_DEST = /pub/software/scm/git/docs
424424

425425
howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
426426
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
427-
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
427+
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
428428
sed -e '1,/^$$/d' $< | \
429-
$(TXT_TO_HTML) - >$@+ && \
430-
mv $@+ $@
429+
$(TXT_TO_HTML) - >$@.new && \
430+
mv $@.new $@
431431

432432
install-webdoc : html
433433
'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)

Documentation/gitattributes.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,36 @@ sign `$` upon checkout. Any byte sequence that begins with
378378
with `$Id$` upon check-in.
379379

380380

381+
`symlink`
382+
^^^^^^^^^
383+
384+
On Windows, symbolic links have a type: a "file symlink" must point at
385+
a file, and a "directory symlink" must point at a directory. If the
386+
type of symlink does not match its target, it doesn't work.
387+
388+
Git does not record the type of symlink in the index or in a tree. On
389+
checkout it'll guess the type, which only works if the target exists
390+
at the time the symlink is created. This may often not be the case,
391+
for example when the link points at a directory inside a submodule.
392+
393+
The `symlink` attribute allows you to explicitly set the type of symlink
394+
to `file` or `dir`, so Git doesn't have to guess. If you have a set of
395+
symlinks that point at other files, you can do:
396+
397+
------------------------
398+
*.gif symlink=file
399+
------------------------
400+
401+
To tell Git that a symlink points at a directory, use:
402+
403+
------------------------
404+
tools_folder symlink=dir
405+
------------------------
406+
407+
The `symlink` attribute is ignored on platforms other than Windows,
408+
since they don't distinguish between different types of symlinks.
409+
410+
381411
`filter`
382412
^^^^^^^^
383413

builtin/clean.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
577577
clean_get_color(CLEAN_COLOR_RESET));
578578
}
579579

580+
fflush(stdout);
580581
if (strbuf_getline_lf(&choice, stdin) != EOF) {
581582
strbuf_trim(&choice);
582583
} else {
@@ -659,6 +660,7 @@ static int filter_by_patterns_cmd(void)
659660
clean_print_color(CLEAN_COLOR_PROMPT);
660661
printf(_("Input ignore patterns>> "));
661662
clean_print_color(CLEAN_COLOR_RESET);
663+
fflush(stdout);
662664
if (strbuf_getline_lf(&confirm, stdin) != EOF)
663665
strbuf_trim(&confirm);
664666
else
@@ -757,6 +759,7 @@ static int ask_each_cmd(void)
757759
qname = quote_path_relative(item->string, NULL, &buf);
758760
/* TRANSLATORS: Make sure to keep [y/N] as is */
759761
printf(_("Remove %s [y/N]? "), qname);
762+
fflush(stdout);
760763
if (strbuf_getline_lf(&confirm, stdin) != EOF) {
761764
strbuf_trim(&confirm);
762765
} else {

0 commit comments

Comments
 (0)