[PATCH 00/20] "git worktree move" preview

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

 



This is the rough first cut of "git worktree move" for early
feedback. The series adds "git worktree move" which can

 - move a linked worktree to another place
 - move .git repository away

The first use case is obvious. The second less so.

Main worktree has always been an odd ball because it does not always
behave like a linked worktree. You can't move it (because you'll be
moving the repo along), you don't know where it is from 'worktree
list' because it's not tracked the same way. The move of .git dir will
automatically convert the main worktree to linked one, making it equal
to all other worktrees.

At the code level, it should be noted that I import copy_file() from
busybox for whole directory copy that preserves file permission and
stuff. Either that or I need to rely on POSIX command "cp" or "mv".
But that would make Windows adaptation harder later on.

A little off topic. The first two patches adds sys_error() that, like
die_errno(), automatically do strerror(). There's a 38 patches series
to convert error("...: %s", ..., strerror(errno)) to use it. I think
it's a good idea. So unless somebody objects, I'll post it some time
later.

Nguyễn Thái Ngọc Duy (20):
  usage.c: move format processing out of die_errno()
  usage.c: add sys_error() that prints strerror() automatically
  path.c: add git_common_path() and strbuf_git_common_path()
  path.c: add is_git_path_shared()
  copy.c: add copy_dir_recursively()
  worktree.c: use is_dot_or_dotdot()
  worktree.c: store "id" instead of "git_dir"
  worktree.c: add clear_worktree()
  worktree.c: add find_worktree_by_path()
  worktree.c: add is_main_worktree()
  worktree.c: recognize no main worktree
  worktree.c: add update_worktree_location()
  worktree.c: add update_worktree_gitfile()
  worktree.c: add collect_per_worktree_git_paths()
  worktree: avoid 0{40}, too many zeroes, hard to read
  worktree: simplify prefixing paths
  worktree: add "move" commmand
  worktree: refactor add_worktree()
  worktree: move repo, simple case
  worktree: move repo, convert main worktree

 builtin/worktree.c                | 297 ++++++++++++++++++++++++------
 cache.h                           |   6 +
 copy.c                            | 371 ++++++++++++++++++++++++++++++++++++++
 git-compat-util.h                 |   1 +
 path.c                            |  56 +++++-
 t/t2028-worktree-move.sh (new +x) |  77 ++++++++
 usage.c                           |  35 +++-
 worktree.c                        | 161 +++++++++++++++--
 worktree.h                        |  42 ++++-
 9 files changed, 963 insertions(+), 83 deletions(-)
 create mode 100755 t/t2028-worktree-move.sh

-- 
2.7.0.377.g4cd97dd

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]