25
possum
5y

Fun Fact: Did you know that git clone starts a child process for downloading the repo but the parent process terminates, therefore working in an asynchrone way so &&-ing the next instruction, which might rely on those files, won't help you?
Well now you know, and so do I.
Fornicating piece of excrement, what a fun afternoon.

Comments
  • 2
    How large is your repo ??
  • 2
    @devphobe At that time it was like 20MB and the machine was a test VM, which was enough to make the whole script fail. Now that it is smaller, all works fine (tested it again right now). This thing is mocking me.
  • 4
    @possum background tasks suck. I've written way too many "expect" bash scripts that wait until other tasks finish.
  • 2
    @possum Is there a flag to disable this?
  • 3
    @Demolishun As far as my research has come, no.
  • 3
  • 1
    Git: the biggest mistake the software industry ever made.
  • 1
    @possum i'm very confused.

    Can u link the bash script?

    Usually this shouldn't matter at all...
  • 0
    @M3m35terJ05h That's cool, thx!
  • 0
    @IntrusionCM There's no link to this script, as it is on a private server.
    Code was as follows:

    git clone <url to private repo with access token>
    if [ -f '/file/is/there' ]; then
    mv /download/repoName /new/location
    fi

    I tried with and without checking existence, both failed.
    Now that the repo is smaller it works just fine now (as I've said, this thing is mocking me).
  • 1
    I want this to be DevRant... not copy paste jokes!
  • 1
    Can you use the --progress flag and monitor the progress of the clone by looking at standard error? Then look for something that indicates the clone is finished?
  • 0
    @fzammetti
    >implying the ultimate Ctrl+Z is a mistake
    >implying java is not the industry's worst mistake
  • 0
    @possum I think the error lies somewhere else....
    Yes git does start eg git-remote... as a child process, but the parent process shouldn't exit before the child processes exited.

    As such, git clone should work...

    Where are the files stored? A local drive or a network share?

    I think the error is somewhere else...
  • 0
    @Demolishun I didn't know about that solution, thanks for pointing this out.
  • 0
    @IntrusionCM Infrastructure:
    Github Enterprise, self hosted instance by the university
    Ubuntu Server, virtualised machine, hosted by the university
    Tested on: VM, matching prod as close as possible, running on my own machine at home

    The download took quite some time as a team mate had pushed his node_modules, and inside my own test VM it took even longer. All tests led me to believe, that the script did not wait for the clone to finish and moved on.
    The problem is "solved" now, as the download completes much faster and &&-ing the next instruction perfectly works, which it did absolutely not back then.
  • 0
    @AndroidJester Indeed. Doesn't make it right or good, but can't argue with facts: Git is the de-facto standard in SCM at this point, so people like me can hate it all we want, but we gotta deal with it either way.
Add Comment