seeraven / gitcache

Local cache for git repositories to speed up working with large repositories and multiple clones.
BSD 3-Clause "New" or "Revised" License
37 stars 6 forks source link

Repeat Initial when clone #18

Closed guoh27 closed 1 year ago

guoh27 commented 1 year ago

I export PATH with gitcache, and I run git clone https://github.com/seeraven/gitcache.git

It output as below:

root@1ffc1000999a:/# git clone https://github.com/seeraven/gitcache.git 
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:48 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:41:49 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
^CTraceback (most recent call last):
  File "/gitcache/git", line 40, in <module>
    handle_git_command(sys.argv[0:1], sys.argv[1:])
  File "/gitcache/git_cache/git_command.py", line 95, in handle_git_command
    sys.exit(git_clone(git_options))
  File "/gitcache/git_cache/commands/clone.py", line 53, in git_clone
    return mirror.clone_from_mirror(git_options)
  File "/gitcache/git_cache/git_mirror.py", line 272, in clone_from_mirror
    if not self.update(ref):
  File "/gitcache/git_cache/git_mirror.py", line 149, in update
    return self._clone(ref)
  File "/gitcache/git_cache/git_mirror.py", line 363, in _clone
    remove_dir=self.git_dir)
  File "/gitcache/git_cache/command_execution.py", line 129, in pretty_call_command_retry
    return_code, stdout_buffer, stderr_buffer = call_command_retry(command, num_retries, **kwargs)
  File "/gitcache/git_cache/command_execution.py", line 83, in call_command_retry
    output_timeout=output_timeout)
  File "/gitcache/git_cache/command_execution_unix.py", line 115, in call_command
    streams_ready = select.select([stdout_r, stderr_r], [], [], 1.0)[0]
KeyboardInterrupt
guoh27 commented 1 year ago

With GITCACHE_LOGLEVEL=Debug

2023-11-01 14:46:42 Starting Initial clone of https://github.com/seeraven/gitcache.git into /root/.gitcache/mirrors/github.com/seeraven/gitcache.
2023-11-01 14:46:42 Retry to execute command '/gitcache/git clone --progress --mirror https://github.com/seeraven/gitcache.git /root/.gitcache/mirrors/github.com/seeraven/gitcache/git' up to 3 times.
2023-11-01 14:46:42 Execute command '/gitcache/git clone --progress --mirror https://github.com/seeraven/gitcache.git /root/.gitcache/mirrors/github.com/seeraven/gitcache/git' (shell=False, cwd=None) with command timeout of 3600 seconds and output timeout of 300 seconds.
2023-11-01 14:46:42 handle_git_command(['/gitcache/git'], ['clone', '--progress', '--mirror', 'https://github.com/seeraven/gitcache.git', '/root/.gitcache/mirrors/github.com/seeraven/gitcache/git']) started
2023-11-01 14:46:42 Found global options [], command 'clone', command options '['--progress', '--mirror']' and arguments ['https://github.com/seeraven/gitcache.git', '/root/.gitcache/mirrors/github.com/seeraven/gitcache/git'].
2023-11-01 14:46:42 Loading configuration file /root/.gitcache/config.
2023-11-01 14:46:42 Loading configuration file /root/.gitcache/config.
2023-11-01 14:46:42 Can't load configuration file /root/.gitcache/mirrors/github.com/seeraven/gitcache/gitcache.config as it does not exist!
guoh27 commented 1 year ago

I found this because:

ln -s /gitcache/gitcache /gitcache/git
exported PATH=/gitcache:$PATH
git clone https://github.com/seeraven/gitcache.git

It won present if I use absolute path of gitcache.

guoh27 commented 1 year ago

Ok. I know why now. I use sed 's|#!/usr/bin/env python3|#!/usr/bin/python3|' -i /gitcache/git which will make it not a link anymore