Re: [PATCH] maint: ignore unsaved emacs files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/25/2012 05:12 PM, Laine Stump wrote:
> 
> What would be *really* nice is if git could give a *warning* if you
> tried to do git add . and it found any of those files - it would prevent
> the cases where you forget to save a file that you've modified.

I suppose it IS possible to make 'git commit' complain loudly if you
have unsaved files, or if you tried to add a temporary file as part of
the commit, by modifying .git/hooks/pre-commit, but I'm not sure I have
the best formula for doing that off-hand, and it's the sort of thing
that has to be done in each copy of the tree (and thus, the sort of
thing you would want to automate during bootstrap).

CC'ing Jim, who has done just that in coreutils' bootstrap.conf, in
bootstrap_epilogue():

  # Install our git hooks, as long as "cp" accepts the --backup option,
  # so that we can back up any existing files.
  case $(cp --help) in *--backup*) backup=1;; *) backup=0;; esac
  if test $backup = 1; then
    hooks=$(cd scripts/git-hooks && git ls-files)
    for f in $hooks; do
      # If it is identical, skip it.
      cmp scripts/git-hooks/$f .git/hooks/$f > /dev/null \
        && continue
      cp --backup=numbered scripts/git-hooks/$f .git/hooks
      chmod a-w .git/hooks/$f
    done
  fi

> (For that matter, it would be nice if make did that :-)

I run make all the time with unsaved files; in that scenario, it would
have to be only a warning and not an error.  I'm more comfortable with
it being fatal only in a git hook (which happens when you try to commit
a mess) and not during development (where a mess might be normal, as
part of testing a half-baked theory).  But indeed, if there were a way
to make maint.mk (or cfg.mk) install some GNU make constructs to add a
loud warning on the presence of any editor temporary files, as evidence
that we have sniffed an unsaved file so the build may fail in relation
to what you have just typed into your editor, that might be a nice
improvement.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]