build: fix release name strings for gitian builds

When building from a distdir as gitian does, checking for the .git dir
is not reliable. Instead, ask git if we're in a repo.
remove code below asserts in limitedmap.h (fixes a ToDo)
[Qt] minor changes in splashscreen.cpp

- guard an unused variable with Q_UNUSED() macro
- remove a commented out line of code
Fixing out of bounds asses error
Avoiding referencing elements of an empty vector
[Qt] add more NULL pointer checks in bitcoingui

- add missing checks for clientModel and optionsModel
- small cleanups for an #ifdef on Mac
- remove an unneeded else
Merge pull request #4958

e6beedc [Qt] add more NULL pointer checks in bitcoingui (Philip Kaufmann)
RPC getnetworkinfo: export local node's client sub-version string
Merge pull request #4914

ff36cbe RPC getnetworkinfo: export local node's client sub-version string (Jeff Garzik)
Merge pull request #4966

c8063b5 Fixing out of bounds asses error (ENikS)
Merge pull request #4946

c65cc8c build: fix release name strings for gitian builds (Cory Fields)
Fixed the broken `brew` shell command
Merge pull request #4782

2e5361b remove code below asserts in limitedmap.h (fixes a ToDo) (Philip Kaufmann)
Merge pull request #4967

459a2d2 Avoiding referencing elements of an empty vector (ENikS)
Merge pull request #4959

bb26e2c [Qt] minor changes in splashscreen.cpp (Philip Kaufmann)
script: Fix reference into empty vector run time exception

Edit by laanwj: `begin_ptr(sourcedata) + sourcedata.size()` -> `end_ptr(sourcedata)`
Merge pull request #4968

219372f script: Fix reference into empty vector run time exception (ENikS)
convert CBufferedFile into a RAII wrapper

- it takes over the passed file descriptor and calls fclose() in the
  destructor
- this fixes a leak in LoadExternalBlockFile(), where an exception could
  cause the file to not getting closed