Skip to content

Commit 067d416

Browse files
committed
Merge pull request git-for-windows#1897 from piscisaureus/symlink-attr
Specify symlink type in .gitattributes
2 parents 6c7db9f + 059a694 commit 067d416

26 files changed

+846
-248
lines changed

Documentation/Makefile

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

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

293293
-include doc.dep
294294

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

431431
install-webdoc : html
432432
'$(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
@@ -576,6 +576,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
576576
clean_get_color(CLEAN_COLOR_RESET));
577577
}
578578

579+
fflush(stdout);
579580
if (strbuf_getline_lf(&choice, stdin) != EOF) {
580581
strbuf_trim(&choice);
581582
} else {
@@ -658,6 +659,7 @@ static int filter_by_patterns_cmd(void)
658659
clean_print_color(CLEAN_COLOR_PROMPT);
659660
printf(_("Input ignore patterns>> "));
660661
clean_print_color(CLEAN_COLOR_RESET);
662+
fflush(stdout);
661663
if (strbuf_getline_lf(&confirm, stdin) != EOF)
662664
strbuf_trim(&confirm);
663665
else
@@ -756,6 +758,7 @@ static int ask_each_cmd(void)
756758
qname = quote_path_relative(item->string, NULL, &buf);
757759
/* TRANSLATORS: Make sure to keep [y/N] as is */
758760
printf(_("Remove %s [y/N]? "), qname);
761+
fflush(stdout);
759762
if (strbuf_getline_lf(&confirm, stdin) != EOF) {
760763
strbuf_trim(&confirm);
761764
} else {

0 commit comments

Comments
 (0)